diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-06-19 15:13:04 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-19 15:18:30 +0100 |
commit | d3c1c8d7587239abcf5448ee143a61fe54b01422 (patch) | |
tree | 205d8ca482dbb480bf773da6235ee134b68831ce /sfx2 | |
parent | 41efa1535827b3dfef66ed4ce6c20e85081fe060 (diff) |
expand scheme to share sizes for paragraph dialog preview widgets
Change-Id: Id1ded6828468ff956c83eb57f1da62fd80761b5d
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/Library_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/source/dialog/dialoghelper.cxx | 59 |
2 files changed, 60 insertions, 0 deletions
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index aefe3a2d116d..161a6f736698 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -150,6 +150,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/dialog/alienwarn \ sfx2/source/dialog/basedlgs \ sfx2/source/dialog/checkin \ + sfx2/source/dialog/dialoghelper \ sfx2/source/dialog/dinfdlg \ sfx2/source/dialog/dinfedt \ sfx2/source/dialog/dockwin \ diff --git a/sfx2/source/dialog/dialoghelper.cxx b/sfx2/source/dialog/dialoghelper.cxx new file mode 100644 index 000000000000..89fd3adbabad --- /dev/null +++ b/sfx2/source/dialog/dialoghelper.cxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sfx2/dialoghelper.hxx> +#include <vcl/builder.hxx> +#include <vcl/layout.hxx> +#include <vector> + +//these tab pages both have the same basic layout with a preview on the +//right, get both of their non-preview areas to request the same size +//so that the preview appears in the same place in each one so +//flipping between tabs isn't distracting as it jumps around +void setPreviewsToSamePlace(Window *pParent, VclBuilderContainer *pPage) +{ + Window *pOurGrid = pPage->get<Window>("maingrid"); + if (!pOurGrid) + return; + + std::vector<Window*> aGrids; + aGrids.push_back(pOurGrid); + + for (Window* pChild = pParent->GetWindow(WINDOW_FIRSTCHILD); pChild; + pChild = pChild->GetWindow(WINDOW_NEXT)) + { + VclBuilderContainer *pPeer = dynamic_cast<VclBuilderContainer*>(pChild); + if (!pPeer || pPeer == pPage || !pPeer->hasBuilder()) + continue; + + Window *pOtherGrid = pPeer->get<Window>("maingrid"); + if (!pOtherGrid) + continue; + + aGrids.push_back(pOtherGrid); + } + + if (aGrids.size() > 1) + { + boost::shared_ptr< VclSizeGroup > xGroup(new VclSizeGroup); + for (std::vector<Window*>::iterator aI = aGrids.begin(); aI != aGrids.end(); ++aI) + { + Window *pWindow = *aI; + pWindow->remove_from_all_size_groups(); + pWindow->add_to_size_group(xGroup); + } + } +} + +Size getParagraphPreviewOptimalSize(const Window *pReference) +{ + return pReference->LogicToPixel(Size(68 , 112), MAP_APPFONT); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |