summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorKeith Curtis <keithcu@gmail.com>2014-01-02 16:01:07 -0500
committerTor Lillqvist <tml@collabora.com>2014-03-25 11:37:25 +0200
commitbb910dd8563cc2c40e47cd99e890fb2d30373308 (patch)
tree083e01a2462801f6a0ee54916876fdc1b4c84e7e /sfx2
parent103e5733105c26a923bbe4e7028007649d8d4f20 (diff)
hidpi: Sidebar, fontwork, autoformat and other improvements.
This is a second batch of HiDPI changes. It fixes the following areas: Sidebar * Impress Master pages preview * deck title height * tab (icon) bar * valueset dropdown control * wider maximum width * Draw and other misc. buttons which didn't get fixed by earlier change to Toolbar.SetItemImage There are several more sidebar issues, but it is much improved. Other changes * Writer and Calc auto-format dialog text * file-properties document image * fontwork gallery preview size * Calc table border control Change-Id: I95a0169a3b011836b1c75b3dcacb2733c9567ef3 Reviewed-on: https://gerrit.libreoffice.org/8519 Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx11
-rw-r--r--sfx2/source/sidebar/DeckLayouter.cxx8
-rw-r--r--sfx2/source/sidebar/SidebarChildWindow.cxx2
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx32
-rw-r--r--sfx2/source/sidebar/TabBar.cxx25
5 files changed, 55 insertions, 23 deletions
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index c603adca604c..4975c615a126 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1055,7 +1055,16 @@ void SfxDocumentPage::Reset( const SfxItemSet& rSet )
aURL.SetSmartProtocol( INET_PROT_FILE );
aURL.SetSmartURL( aFactory);
const OUString& rMainURL = aURL.GetMainURL( INetURLObject::NO_DECODE );
- m_pBmp->SetImage( SvFileInformationManager::GetImage( aURL, sal_True ) );
+ Image aImage = SvFileInformationManager::GetImage( aURL, sal_True );
+
+ if ( GetDPIScaleFactor() > 1)
+ {
+ BitmapEx b = aImage.GetBitmapEx();
+ b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor());
+ aImage = Image(b);
+ }
+
+ m_pBmp->SetImage( aImage );
// determine size and type
OUString aSizeText( m_aUnknownSize );
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index 9dcc3585a6ee..c87625b3458c 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -201,7 +201,6 @@ sal_Int32 DeckLayouter::PlacePanels (
{
::std::vector<sal_Int32> aSeparators;
const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
- const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight));
sal_Int32 nY (0);
// Assign heights and places.
@@ -220,6 +219,8 @@ sal_Int32 DeckLayouter::PlacePanels (
PanelTitleBar* pTitleBar = rPanel.GetTitleBar();
if (pTitleBar != NULL)
{
+ const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight) * rPanel.GetDPIScaleFactor());
+
if (iItem->mbShowTitleBar)
{
pTitleBar->setPosSizePixel(0, nY, nWidth, nPanelTitleBarHeight);
@@ -295,7 +296,6 @@ void DeckLayouter::GetRequestedSizes (
{
rAvailableHeight = rContentBox.GetHeight();
- const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight));
const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
IterateLayoutItems(iItem,rLayoutItems)
@@ -315,6 +315,8 @@ void DeckLayouter::GetRequestedSizes (
{
// Show the title bar and a separator above and below
// the title bar.
+ const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight) * iItem->mpPanel->GetDPIScaleFactor());
+
rAvailableHeight -= nPanelTitleBarHeight;
rAvailableHeight -= nDeckSeparatorHeight;
}
@@ -438,7 +440,7 @@ Rectangle DeckLayouter::PlaceDeckTitle (
}
else
{
- const sal_Int32 nDeckTitleBarHeight (Theme::GetInteger(Theme::Int_DeckTitleBarHeight));
+ const sal_Int32 nDeckTitleBarHeight (Theme::GetInteger(Theme::Int_DeckTitleBarHeight) * rDeckTitleBar.GetDPIScaleFactor());
rDeckTitleBar.setPosSizePixel(
rAvailableSpace.Left(),
rAvailableSpace.Top(),
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx
index 8ef593acd01c..f4347b1ccbf8 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -68,7 +68,7 @@ sal_Int32 SidebarChildWindow::GetDefaultWidth (Window* pWindow)
const static sal_Int32 nMaxPropertyPageWidth (115);
return pWindow->LogicToPixel(Point(nMaxPropertyPageWidth,1), MAP_APPFONT).X()
- + TabBar::GetDefaultWidth();
+ + TabBar::GetDefaultWidth() * pWindow->GetDPIScaleFactor();
}
else
return 0;
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index d6fd4ba301a1..357c5456c4fe 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -338,11 +338,12 @@ void SidebarController::NotifyResize (void)
}
Window* pParentWindow = mpTabBar->GetParent();
+ sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor();
const sal_Int32 nWidth (pParentWindow->GetSizePixel().Width());
const sal_Int32 nHeight (pParentWindow->GetSizePixel().Height());
- mbIsDeckOpen = (nWidth > TabBar::GetDefaultWidth());
+ mbIsDeckOpen = (nWidth > nTabBarDefaultWidth);
if (mnSavedSidebarWidth <= 0)
mnSavedSidebarWidth = nWidth;
@@ -352,9 +353,9 @@ void SidebarController::NotifyResize (void)
{
const bool bIsOpening (nWidth > mnWidthOnSplitterButtonDown);
if (bIsOpening)
- bIsDeckVisible = nWidth >= TabBar::GetDefaultWidth() + gnWidthOpenThreshold;
+ bIsDeckVisible = nWidth >= nTabBarDefaultWidth + gnWidthOpenThreshold;
else
- bIsDeckVisible = nWidth >= TabBar::GetDefaultWidth() + gnWidthCloseThreshold;
+ bIsDeckVisible = nWidth >= nTabBarDefaultWidth + gnWidthCloseThreshold;
mbIsDeckRequestedOpen = bIsDeckVisible;
UpdateCloseIndicator(!bIsDeckVisible);
}
@@ -371,7 +372,7 @@ void SidebarController::NotifyResize (void)
{
if (bIsDeckVisible)
{
- mpCurrentDeck->setPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight);
+ mpCurrentDeck->setPosSizePixel(0,0, nWidth-nTabBarDefaultWidth, nHeight);
mpCurrentDeck->Show();
mpCurrentDeck->RequestLayout();
}
@@ -380,19 +381,19 @@ void SidebarController::NotifyResize (void)
}
// Now place the tab bar.
- mpTabBar->setPosSizePixel(nWidth-TabBar::GetDefaultWidth(),0,TabBar::GetDefaultWidth(),nHeight);
+ mpTabBar->setPosSizePixel(nWidth-nTabBarDefaultWidth,0,nTabBarDefaultWidth,nHeight);
mpTabBar->Show();
}
else if ( pSplitWindow->GetAlign() == WINDOWALIGN_LEFT) // attach the Sidebar towards the left-side of screen
{
// Place the tab bar first.
- mpTabBar->setPosSizePixel(0,0,TabBar::GetDefaultWidth(),nHeight);
+ mpTabBar->setPosSizePixel(0,0,nTabBarDefaultWidth,nHeight);
mpTabBar->Show();
// Now place the deck.
if (bIsDeckVisible)
{
- mpCurrentDeck->setPosSizePixel(TabBar::GetDefaultWidth(),0, nWidth-TabBar::GetDefaultWidth(), nHeight);
+ mpCurrentDeck->setPosSizePixel(nTabBarDefaultWidth,0, nWidth-nTabBarDefaultWidth, nHeight);
mpCurrentDeck->Show();
mpCurrentDeck->RequestLayout();
}
@@ -436,7 +437,7 @@ void SidebarController::ProcessNewWidth (const sal_Int32 nNewWidth)
mbIsDeckOpen = true;
RequestCloseDeck();
- if (mnWidthOnSplitterButtonDown > TabBar::GetDefaultWidth())
+ if (mnWidthOnSplitterButtonDown > TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor())
mnSavedSidebarWidth = mnWidthOnSplitterButtonDown;
}
}
@@ -688,7 +689,7 @@ void SidebarController::SwitchToDeck (
mpCurrentDeck->setPosSizePixel(
0,
0,
- mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth(),
+ mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor(),
mpParentWindow->GetSizePixel().Height());
mpCurrentDeck->SetPanels(aNewPanels);
@@ -1014,6 +1015,8 @@ void SidebarController::UpdateDeckOpenState (void)
// No state requested.
return;
+ sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor();
+
// Update (change) the open state when it either has not yet been initialized
// or when its value differs from the requested state.
if ( ! mbIsDeckOpen
@@ -1021,7 +1024,7 @@ void SidebarController::UpdateDeckOpenState (void)
{
if (mbIsDeckRequestedOpen.get())
{
- if (mnSavedSidebarWidth <= TabBar::GetDefaultWidth())
+ if (mnSavedSidebarWidth <= nTabBarDefaultWidth)
SetChildWindowWidth(SidebarChildWindow::GetDefaultWidth(mpParentWindow));
else
SetChildWindowWidth(mnSavedSidebarWidth);
@@ -1029,8 +1032,8 @@ void SidebarController::UpdateDeckOpenState (void)
else
{
if ( ! mpParentWindow->IsFloatingMode())
- mnSavedSidebarWidth = SetChildWindowWidth(TabBar::GetDefaultWidth());
- if (mnWidthOnSplitterButtonDown > TabBar::GetDefaultWidth())
+ mnSavedSidebarWidth = SetChildWindowWidth(nTabBarDefaultWidth);
+ if (mnWidthOnSplitterButtonDown > nTabBarDefaultWidth)
mnSavedSidebarWidth = mnWidthOnSplitterButtonDown;
mpParentWindow->SetStyle(mpParentWindow->GetStyle() & ~WB_SIZEABLE);
}
@@ -1109,7 +1112,8 @@ void SidebarController::RestrictWidth (sal_Int32 nWidth)
const sal_uInt16 nSetId (pSplitWindow->GetSet(nId));
pSplitWindow->SetItemSizeRange(
nSetId,
- Range(TabBar::GetDefaultWidth() + nWidth, gnMaximumSidebarWidth));
+ Range(TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor() + nWidth,
+ gnMaximumSidebarWidth * mpTabBar->GetDPIScaleFactor()));
}
}
@@ -1163,7 +1167,7 @@ void SidebarController::UpdateCloseIndicator (const bool bCloseAfterDrag)
const Size aImageSize (mpCloseIndicator->GetSizePixel());
mpCloseIndicator->SetPosPixel(
Point(
- aWindowSize.Width() - TabBar::GetDefaultWidth() - aImageSize.Width(),
+ aWindowSize.Width() - TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor() - aImageSize.Width(),
(aWindowSize.Height() - aImageSize.Height())/2));
mpCloseIndicator->Show();
}
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index ba5974dadf12..353a2bb4238c 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -150,7 +150,14 @@ void TabBar::SetDecks (
void TabBar::UpdateButtonIcons (void)
{
- mpMenuButton->SetModeImage(Theme::GetImage(Theme::Image_TabBarMenu));
+ Image aImage = Theme::GetImage(Theme::Image_TabBarMenu);
+ if ( mpMenuButton->GetDPIScaleFactor() > 1 )
+ {
+ BitmapEx b = aImage.GetBitmapEx();
+ b.Scale(mpMenuButton->GetDPIScaleFactor(), mpMenuButton->GetDPIScaleFactor(), BMP_SCALE_FAST);
+ aImage = Image(b);
+ }
+ mpMenuButton->SetModeImage(aImage);
for(ItemContainer::const_iterator
iItem(maItems.begin()), iEnd(maItems.end());
@@ -159,7 +166,17 @@ void TabBar::UpdateButtonIcons (void)
{
const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
if (pDeckDescriptor != NULL)
- iItem->mpButton->SetModeImage(GetItemImage(*pDeckDescriptor));
+ {
+ aImage = GetItemImage(*pDeckDescriptor);
+ if ( mpMenuButton->GetDPIScaleFactor() > 1 )
+ {
+ BitmapEx b = aImage.GetBitmapEx();
+ b.Scale(mpMenuButton->GetDPIScaleFactor(), mpMenuButton->GetDPIScaleFactor(), BMP_SCALE_FAST);
+ aImage = Image(b);
+ }
+
+ iItem->mpButton->SetModeImage(aImage);
+ }
}
Invalidate();
@@ -178,8 +195,8 @@ void TabBar::Layout (void)
sal_Int32 nX (aPadding.Top());
sal_Int32 nY (aPadding.Left());
const Size aTabItemSize (
- Theme::GetInteger(Theme::Int_TabItemWidth),
- Theme::GetInteger(Theme::Int_TabItemHeight));
+ Theme::GetInteger(Theme::Int_TabItemWidth) * GetDPIScaleFactor(),
+ Theme::GetInteger(Theme::Int_TabItemHeight) * GetDPIScaleFactor());
// Place the menu button and the separator.
if (mpMenuButton != 0)