1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "precompiled_sd.hxx"
25 
26 #include "SlsBitmapFactory.hxx"
27 
28 #include "PreviewRenderer.hxx"
29 #include "view/SlideSorterView.hxx"
30 #include "sdpage.hxx"
31 #include "Window.hxx"
32 #include <drawdoc.hxx>
33 #include "DrawDocShell.hxx"
34 #include <svx/svdtypes.hxx>
35 #include <svx/svdpage.hxx>
36 #include <vcl/bitmapex.hxx>
37 #include <vcl/bmpacc.hxx>
38 #include <vcl/pngwrite.hxx>
39 
40 const static sal_Int32 gnSuperSampleFactor (2);
41 const static bool gbAllowSuperSampling (false);
42 
43 
44 namespace sd { namespace slidesorter { namespace view {
45 class SlideSorterView;
46 class PageObjectViewObjectContact;
47 } } }
48 
49 namespace sd { namespace slidesorter { namespace cache {
50 
BitmapFactory(void)51 BitmapFactory::BitmapFactory (void)
52     : maRenderer(NULL, false)
53 {
54 }
55 
56 
57 
58 
~BitmapFactory(void)59 BitmapFactory::~BitmapFactory (void)
60 {
61 }
62 
63 
64 
65 
CreateBitmap(const SdPage & rPage,const Size & rPixelSize,const bool bDoSuperSampling)66 Bitmap BitmapFactory::CreateBitmap (
67     const SdPage& rPage,
68     const Size& rPixelSize,
69     const bool bDoSuperSampling)
70 {
71     Size aSize (rPixelSize);
72     if (bDoSuperSampling && gbAllowSuperSampling)
73     {
74         aSize.Width() *= gnSuperSampleFactor;
75         aSize.Height() *= gnSuperSampleFactor;
76     }
77 
78     Bitmap aPreview (maRenderer.RenderPage (
79         &rPage,
80         aSize,
81         String(),
82         true,
83         false).GetBitmapEx().GetBitmap());
84     if (bDoSuperSampling && gbAllowSuperSampling)
85     {
86         aPreview.Scale(rPixelSize, BMP_SCALE_INTERPOLATE);
87     }
88 
89     return aPreview;
90 }
91 
92 
93 } } } // end of namespace ::sd::slidesorter::cache
94 
95 
96 
97