Kaydet (Commit) ae37972c authored tarafından Keith Curtis's avatar Keith Curtis Kaydeden (comit) Jan Holesovsky

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
üst bdc19273
......@@ -109,7 +109,7 @@ void ScAutoFmtPreview::MakeFonts( sal_uInt16 nIndex, Font& rFont, Font& rCJKFont
if ( pCurData )
{
rFont = rCJKFont = rCTLFont = GetFont();
Size aFontSize( rFont.GetSize().Width(), 10 );
Size aFontSize( rFont.GetSize().Width(), 10 * GetDPIScaleFactor() );
const SvxFontItem* pFontItem = (const SvxFontItem*) pCurData->GetItem( nIndex, ATTR_FONT );
const SvxWeightItem* pWeightItem = (const SvxWeightItem*) pCurData->GetItem( nIndex, ATTR_FONT_WEIGHT );
......
......@@ -167,6 +167,7 @@ Control RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE
DialogControl = TRUE;
Border = FALSE;
//This is broken with the auto-doubled hidpi bitmaps
Size = MAP_PIXEL( POPUPPANEL_MARGIN_SMALL_PIXEL * 2 + 108, POPUPPANEL_MARGIN_SMALL_PIXEL * 2 + 138);
ToolBox TB_BORDER1
......
......@@ -87,6 +87,10 @@ MasterPagesSelector::MasterPagesSelector (
PreviewValueSet::SetRightMouseClickHandler (
LINK(this, MasterPagesSelector, RightClickHandler));
PreviewValueSet::SetStyle(PreviewValueSet::GetStyle() | WB_NO_DIRECTSELECT);
if ( GetDPIScaleFactor() > 1 )
mpContainer->SetPreviewSize(MasterPageContainer::LARGE);
PreviewValueSet::SetPreviewSize(mpContainer->GetPreviewSizePixel());
PreviewValueSet::Show();
......
......@@ -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 );
......
......@@ -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(),
......
......@@ -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;
......
......@@ -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();
}
......
......@@ -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)
......
......@@ -99,6 +99,21 @@ void ValueSetWithTextControl::AddItem(
aItem.maSelectedItemImage = (pSelectedItemImage != 0)
? *pSelectedItemImage
: rItemImage;
if ( GetDPIScaleFactor() > 1 )
{
BitmapEx b = aItem.maItemImage.GetBitmapEx();
b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor());
aItem.maItemImage = Image(b);
if ( pSelectedItemImage != 0 )
{
b = aItem.maSelectedItemImage.GetBitmapEx();
b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor());
aItem.maSelectedItemImage = Image(b);
}
}
aItem.maItemText = rItemText;
maItems.push_back( aItem );
......@@ -151,6 +166,20 @@ void ValueSetWithTextControl::ReplaceItemImages(
maItems[nItemId-1].maSelectedItemImage = (pSelectedItemImage != 0)
? *pSelectedItemImage
: rItemImage;
if ( GetDPIScaleFactor() > 1 )
{
BitmapEx b = maItems[nItemId-1].maItemImage.GetBitmapEx();
b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor());
maItems[nItemId-1].maItemImage = Image(b);
if ( pSelectedItemImage != 0 )
{
b = maItems[nItemId-1].maSelectedItemImage.GetBitmapEx();
b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor());
maItems[nItemId-1].maSelectedItemImage = Image(b);
}
}
}
......
......@@ -126,6 +126,10 @@ void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId)
{
VirtualDevice aVDev;
const Point aNull(0, 0);
if (GetDPIScaleFactor() > 1)
aThumb.Scale(GetDPIScaleFactor(), GetDPIScaleFactor());
const Size aSize(aThumb.GetSizePixel());
aVDev.SetOutputSizePixel(aSize);
......
......@@ -1265,6 +1265,17 @@ SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFram
AddStatusListener(OUString(".uno:BorderReducedMode"));
aImgList = ImageList( SVX_RES( RID_SVXIL_FRAME ) );
if( pParentWindow->GetDPIScaleFactor() > 1 )
{
for (short i = 0; i < aImgList.GetImageCount(); i++)
{
OUString rImageName = aImgList.GetImageName(i);
BitmapEx b = aImgList.GetImage(rImageName).GetBitmapEx();
b.Scale(pParentWindow->GetDPIScaleFactor(), pParentWindow->GetDPIScaleFactor());
aImgList.ReplaceImage(rImageName, Image(b));
}
}
/*
* 1 2 3 4
* -------------------------------------
......@@ -1287,7 +1298,7 @@ SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFram
aFrameSet.SetColCount( 4 );
aFrameSet.SetSelectHdl( LINK( this, SvxFrameWindow_Impl, SelectHdl ) );
lcl_CalcSizeValueSet( *this, aFrameSet,Size( 20, 20 ));
lcl_CalcSizeValueSet( *this, aFrameSet, Size( 20 * pParentWindow->GetDPIScaleFactor(), 20 * pParentWindow->GetDPIScaleFactor() ));
SetHelpId( HID_POPUP_FRAME );
SetText( SVX_RESSTR(RID_SVXSTR_FRAME) );
......
......@@ -566,7 +566,7 @@ void AutoFmtPreview::MakeFonts( sal_uInt8 nIndex, Font& rFont, Font& rCJKFont, F
const SwBoxAutoFmt& rBoxFmt = aCurData.GetBoxFmt( nIndex );
rFont = rCJKFont = rCTLFont = GetFont();
Size aFontSize( rFont.GetSize().Width(), 10 );
Size aFontSize( rFont.GetSize().Width(), 10 * GetDPIScaleFactor() );
lcl_SetFontProperties( rFont, rBoxFmt.GetFont(), rBoxFmt.GetWeight(), rBoxFmt.GetPosture() );
lcl_SetFontProperties( rCJKFont, rBoxFmt.GetCJKFont(), rBoxFmt.GetCJKWeight(), rBoxFmt.GetCJKPosture() );
......
......@@ -624,6 +624,7 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage,
// Item anlegen und in die Liste einfuegen
mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, nBits ) );
SetItemImage(nItemId, rImage);
mpData->ImplClearLayoutData();
ImplInvalidate( sal_True );
......@@ -645,6 +646,7 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage,
// Item anlegen und in die Liste einfuegen
mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, ImplConvertMenuString( rText ), nBits ) );
SetItemImage(nItemId, rImage);
mpData->ImplClearLayoutData();
ImplInvalidate( sal_True );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment