1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <sfx2/dialoghelper.hxx>
11 #include <tools/datetime.hxx>
12 #include <vcl/builder.hxx>
13 #include <vcl/layout.hxx>
14 #include <vcl/settings.hxx>
17 //these tab pages both have the same basic layout with a preview on the
18 //right, get both of their non-preview areas to request the same size
19 //so that the preview appears in the same place in each one so
20 //flipping between tabs isn't distracting as it jumps around
21 void setPreviewsToSamePlace(vcl::Window
*pParent
, VclBuilderContainer
*pPage
)
23 vcl::Window
*pOurGrid
= pPage
->get
<vcl::Window
>("maingrid");
27 std::vector
<vcl::Window
*> aGrids
;
28 aGrids
.push_back(pOurGrid
);
30 for (vcl::Window
* pChild
= pParent
->GetWindow(GetWindowType::FirstChild
); pChild
;
31 pChild
= pChild
->GetWindow(GetWindowType::Next
))
33 VclBuilderContainer
*pPeer
= dynamic_cast<VclBuilderContainer
*>(pChild
);
34 if (!pPeer
|| pPeer
== pPage
|| !pPeer
->hasBuilder())
37 vcl::Window
*pOtherGrid
= pPeer
->get
<vcl::Window
>("maingrid");
41 aGrids
.push_back(pOtherGrid
);
44 if (aGrids
.size() > 1)
46 std::shared_ptr
<VclSizeGroup
> xGroup(std::make_shared
<VclSizeGroup
>());
47 for (std::vector
<vcl::Window
*>::iterator aI
= aGrids
.begin(); aI
!= aGrids
.end(); ++aI
)
49 vcl::Window
*pWindow
= *aI
;
50 pWindow
->remove_from_all_size_groups();
51 pWindow
->add_to_size_group(xGroup
);
56 Size
getParagraphPreviewOptimalSize(const vcl::Window
*pReference
)
58 return pReference
->LogicToPixel(Size(68 , 112), MAP_APPFONT
);
61 Size
getDrawPreviewOptimalSize(const vcl::Window
*pReference
)
63 return pReference
->LogicToPixel(Size(88, 42), MAP_APPFONT
);
66 Size
getDrawListBoxOptimalSize(const vcl::Window
*pReference
)
68 return pReference
->LogicToPixel(Size(88, 110), MAP_APPFONT
);
71 Size
getPreviewStripSize(const vcl::Window
*pReference
)
73 return pReference
->LogicToPixel(Size(70 , 40), MapMode(MAP_APPFONT
));
76 Size
getPreviewOptionsSize(const vcl::Window
*pReference
)
78 return pReference
->LogicToPixel(Size(70 , 27), MapMode(MAP_APPFONT
));
81 OUString
getWidestTime(const LocaleDataWrapper
& rWrapper
)
83 Date
aDate(22, 12, 2000);
84 tools::Time
aTime(22, 59, 59);
85 DateTime
aDateTime(aDate
, aTime
);
86 return formatTime(aDateTime
, rWrapper
);
89 OUString
formatTime(const DateTime
& rDateTime
, const LocaleDataWrapper
& rWrapper
)
91 OUString sString
= rWrapper
.getDate(rDateTime
);
92 sString
+= OUString(' ');
93 sString
+= rWrapper
.getTime(rDateTime
, false);
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */