2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
/*
|
|
|
|
* 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/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-09-17 11:21:16 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <string.h>
|
2011-01-24 16:34:14 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <tools/debug.hxx>
|
2004-01-06 13:16:03 +00:00
|
|
|
#include <tools/rcid.h>
|
2013-04-19 19:10:54 -04:00
|
|
|
#include <tools/solar.h>
|
2011-01-24 16:34:14 +01:00
|
|
|
|
2007-06-27 19:33:43 +00:00
|
|
|
#include <vcl/event.hxx>
|
|
|
|
#include <vcl/wall.hxx>
|
|
|
|
#include <vcl/bitmap.hxx>
|
|
|
|
#include <vcl/decoview.hxx>
|
|
|
|
#include <vcl/image.hxx>
|
|
|
|
#include <vcl/help.hxx>
|
|
|
|
#include <vcl/splitwin.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-04-19 19:10:54 -04:00
|
|
|
#include <rsc/rsc-vcl-shared-types.hxx>
|
|
|
|
|
2011-01-24 16:34:14 +01:00
|
|
|
#include <svdata.hxx>
|
|
|
|
#include <svids.hrc>
|
2003-12-01 12:39:50 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// =======================================================================
|
|
|
|
|
2010-03-19 15:06:39 +01:00
|
|
|
// Attention: Must not contain non-PODs because array is enlarged/copied
|
|
|
|
// with the use of memmove/memcpy.
|
2000-09-18 16:07:07 +00:00
|
|
|
struct ImplSplitItem
|
|
|
|
{
|
|
|
|
long mnSize;
|
|
|
|
long mnPixSize;
|
|
|
|
long mnLeft;
|
|
|
|
long mnTop;
|
|
|
|
long mnWidth;
|
|
|
|
long mnHeight;
|
|
|
|
long mnSplitPos;
|
|
|
|
long mnSplitSize;
|
|
|
|
long mnOldSplitPos;
|
|
|
|
long mnOldSplitSize;
|
|
|
|
long mnOldWidth;
|
|
|
|
long mnOldHeight;
|
|
|
|
ImplSplitSet* mpSet;
|
|
|
|
Window* mpWindow;
|
|
|
|
Window* mpOrgParent;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 mnId;
|
2000-09-18 16:07:07 +00:00
|
|
|
SplitWindowItemBits mnBits;
|
2013-06-21 21:40:18 +09:00
|
|
|
bool mbFixed;
|
|
|
|
bool mbSubSize;
|
2010-03-19 15:06:39 +01:00
|
|
|
/// Minimal width or height of the item. -1 means no restriction.
|
|
|
|
long mnMinSize;
|
|
|
|
/// Maximal width or height of the item. -1 means no restriction.
|
|
|
|
long mnMaxSize;
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ImplSplitSet
|
|
|
|
{
|
|
|
|
ImplSplitItem* mpItems;
|
|
|
|
Wallpaper* mpWallpaper;
|
|
|
|
Bitmap* mpBitmap;
|
|
|
|
long mnLastSize;
|
|
|
|
long mnSplitSize;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 mnItems;
|
|
|
|
sal_uInt16 mnId;
|
2013-06-21 21:40:18 +09:00
|
|
|
bool mbCalcPix;
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
|
|
|
|
2010-03-19 15:06:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
/** Check whether the given size is inside the valid range defined by
|
|
|
|
[rItem.mnMinSize,rItem.mnMaxSize]. When it is not inside it then return
|
|
|
|
the upper or lower bound, respectively. Otherwise return the given size
|
|
|
|
unmodified.
|
|
|
|
Note that either mnMinSize and/or mnMaxSize can be -1 in which case the
|
|
|
|
size has not lower or upper bound.
|
|
|
|
*/
|
|
|
|
namespace {
|
2011-05-08 17:04:25 +02:00
|
|
|
long ValidateSize (const long nSize, const ImplSplitItem &rItem)
|
2010-03-19 15:06:39 +01:00
|
|
|
{
|
|
|
|
if (rItem.mnMinSize>=0 && nSize<rItem.mnMinSize)
|
|
|
|
return rItem.mnMinSize;
|
|
|
|
else if (rItem.mnMaxSize>0 && nSize>rItem.mnMaxSize)
|
|
|
|
return rItem.mnMaxSize;
|
|
|
|
else
|
|
|
|
return nSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-09 15:34:16 +00:00
|
|
|
#define SPLITWIN_SPLITSIZE 3
|
|
|
|
#define SPLITWIN_SPLITSIZEEX 4
|
2005-01-31 12:25:46 +00:00
|
|
|
#define SPLITWIN_SPLITSIZEEXLN 6
|
2004-09-09 15:34:16 +00:00
|
|
|
#define SPLITWIN_SPLITSIZEAUTOHIDE 36
|
|
|
|
#define SPLITWIN_SPLITSIZEFADE 36
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
#define SPLIT_HORZ ((sal_uInt16)0x0001)
|
|
|
|
#define SPLIT_VERT ((sal_uInt16)0x0002)
|
|
|
|
#define SPLIT_WINDOW ((sal_uInt16)0x0004)
|
|
|
|
#define SPLIT_NOSPLIT ((sal_uInt16)0x8000)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
static void ImplCalcBorder( WindowAlign eAlign, sal_Bool bNoAlign,
|
2000-09-18 16:07:07 +00:00
|
|
|
long& rLeft, long& rTop,
|
|
|
|
long& rRight, long& rBottom )
|
|
|
|
{
|
|
|
|
if ( bNoAlign )
|
|
|
|
{
|
|
|
|
rLeft = 2;
|
|
|
|
rTop = 2;
|
|
|
|
rRight = 2;
|
|
|
|
rBottom = 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-02-18 14:18:19 +01:00
|
|
|
switch ( eAlign )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-02-18 14:18:19 +01:00
|
|
|
case WINDOWALIGN_TOP:
|
2005-01-31 12:25:46 +00:00
|
|
|
rLeft = 2;
|
2000-09-18 16:07:07 +00:00
|
|
|
rTop = 2;
|
2005-01-31 12:25:46 +00:00
|
|
|
rRight = 2;
|
2000-09-18 16:07:07 +00:00
|
|
|
rBottom = 0;
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_LEFT:
|
2000-09-18 16:07:07 +00:00
|
|
|
rLeft = 2;
|
|
|
|
rTop = 2;
|
|
|
|
rRight = 0;
|
|
|
|
rBottom = 2;
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_BOTTOM:
|
2005-01-31 12:25:46 +00:00
|
|
|
rLeft = 2;
|
2000-09-18 16:07:07 +00:00
|
|
|
rTop = 0;
|
2005-01-31 12:25:46 +00:00
|
|
|
rRight = 2;
|
2000-09-18 16:07:07 +00:00
|
|
|
rBottom = 2;
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
default:
|
2000-09-18 16:07:07 +00:00
|
|
|
rLeft = 0;
|
|
|
|
rTop = 2;
|
|
|
|
rRight = 2;
|
|
|
|
rBottom = 2;
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2005-11-01 09:34:10 +00:00
|
|
|
void SplitWindow::ImplDrawBorder( SplitWindow* pWin )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings();
|
|
|
|
long nDX = pWin->mnDX;
|
|
|
|
long nDY = pWin->mnDY;
|
|
|
|
|
|
|
|
if ( pWin->mbNoAlign )
|
|
|
|
{
|
|
|
|
DecorationView aDecoView( pWin );
|
|
|
|
Point aTmpPoint;
|
|
|
|
Rectangle aRect( aTmpPoint, Size( nDX, nDY ) );
|
|
|
|
aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN );
|
|
|
|
}
|
|
|
|
else
|
2011-02-18 17:29:18 -08:00
|
|
|
{
|
2012-02-18 14:18:19 +01:00
|
|
|
switch ( pWin->meAlign )
|
2005-01-31 12:25:46 +00:00
|
|
|
{
|
2012-02-18 14:18:19 +01:00
|
|
|
case WINDOWALIGN_BOTTOM:
|
2005-01-31 12:25:46 +00:00
|
|
|
pWin->SetLineColor( rStyleSettings.GetShadowColor() );
|
|
|
|
pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) );
|
|
|
|
pWin->DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) );
|
|
|
|
pWin->DrawLine( Point( nDX-2, 0 ), Point( nDX-2, nDY-3 ) );
|
|
|
|
|
|
|
|
pWin->SetLineColor( rStyleSettings.GetLightColor() );
|
|
|
|
pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
|
|
|
|
pWin->DrawLine( Point( 1, 1 ), Point( 1, nDY-3 ) );
|
|
|
|
pWin->DrawLine( Point( nDX-1, 0 ), Point( nDX-1, nDY-1 ) );
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_TOP:
|
2005-01-31 12:25:46 +00:00
|
|
|
pWin->SetLineColor( rStyleSettings.GetShadowColor() );
|
|
|
|
pWin->DrawLine( Point( 0, 0 ), Point( nDX-1, 0 ) );
|
|
|
|
pWin->DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) );
|
|
|
|
pWin->DrawLine( Point( nDX-2, 0 ), Point( nDX-2, nDY-1 ) );
|
|
|
|
|
|
|
|
pWin->SetLineColor( rStyleSettings.GetLightColor() );
|
|
|
|
pWin->DrawLine( Point( 1, 1 ), Point( nDX-3, 1 ) );
|
|
|
|
pWin->DrawLine( Point( 1, 1 ), Point( 1, nDY-1 ) );
|
|
|
|
pWin->DrawLine( Point( nDX-1, 1 ), Point( nDX-1, nDY-1 ) );
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_LEFT:
|
2005-01-31 12:25:46 +00:00
|
|
|
pWin->SetLineColor( rStyleSettings.GetShadowColor() );
|
|
|
|
pWin->DrawLine( Point( 0, 0 ), Point( nDX-1, 0 ) );
|
|
|
|
pWin->DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) );
|
|
|
|
pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) );
|
|
|
|
|
|
|
|
pWin->SetLineColor( rStyleSettings.GetLightColor() );
|
|
|
|
pWin->DrawLine( Point( 1, 1 ), Point( nDX-1, 1 ) );
|
|
|
|
pWin->DrawLine( Point( 1, 1 ), Point( 1, nDY-3 ) );
|
|
|
|
pWin->DrawLine( Point( 1, nDY-1 ), Point( nDX-1, nDY-1 ) );
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
default:
|
2005-01-31 12:25:46 +00:00
|
|
|
pWin->SetLineColor( rStyleSettings.GetShadowColor() );
|
|
|
|
pWin->DrawLine( Point( 0, 0 ), Point( nDX-2, 0 ) );
|
|
|
|
pWin->DrawLine( Point( nDX-2, 0 ), Point( nDX-2, nDY-3 ) );
|
|
|
|
pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-2, nDY-2 ) );
|
|
|
|
|
|
|
|
pWin->SetLineColor( rStyleSettings.GetLightColor() );
|
|
|
|
pWin->DrawLine( Point( 0, 1 ), Point( nDX-3, 1 ) );
|
|
|
|
pWin->DrawLine( Point( nDX-1, 0 ), Point( nDX-1, nDY-1 ) );
|
|
|
|
pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
2005-01-31 12:25:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2005-11-01 09:34:10 +00:00
|
|
|
void SplitWindow::ImplDrawBorderLine( SplitWindow* pWin )
|
2005-01-31 12:25:46 +00:00
|
|
|
{
|
|
|
|
if ( pWin->mbFadeOut || pWin->mbAutoHide )
|
|
|
|
{
|
|
|
|
const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings();
|
|
|
|
long nDX = pWin->mnDX;
|
|
|
|
long nDY = pWin->mnDY;
|
|
|
|
|
2012-02-18 14:18:19 +01:00
|
|
|
switch ( pWin->meAlign )
|
2005-01-31 12:25:46 +00:00
|
|
|
{
|
2012-02-18 14:18:19 +01:00
|
|
|
case WINDOWALIGN_LEFT:
|
2005-01-31 12:25:46 +00:00
|
|
|
pWin->SetLineColor( rStyleSettings.GetShadowColor() );
|
|
|
|
pWin->DrawLine( Point( nDX-SPLITWIN_SPLITSIZEEXLN-1, 0 ), Point( nDX-SPLITWIN_SPLITSIZEEXLN-1, nDY-3 ) );
|
|
|
|
pWin->SetLineColor( rStyleSettings.GetLightColor() );
|
|
|
|
pWin->DrawLine( Point( nDX-SPLITWIN_SPLITSIZEEXLN, 1 ), Point( nDX-SPLITWIN_SPLITSIZEEXLN, nDY-4 ) );
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_RIGHT:
|
2005-01-31 12:25:46 +00:00
|
|
|
pWin->SetLineColor( rStyleSettings.GetShadowColor() );
|
|
|
|
pWin->DrawLine( Point( SPLITWIN_SPLITSIZEEXLN-1, 0 ), Point( SPLITWIN_SPLITSIZEEXLN-1, nDY-3 ) );
|
|
|
|
pWin->SetLineColor( rStyleSettings.GetLightColor() );
|
|
|
|
pWin->DrawLine( Point( SPLITWIN_SPLITSIZEEXLN, 1 ), Point( SPLITWIN_SPLITSIZEEXLN, nDY-4 ) );
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_TOP:
|
2005-01-31 12:25:46 +00:00
|
|
|
pWin->SetLineColor( rStyleSettings.GetShadowColor() );
|
|
|
|
pWin->DrawLine( Point( 0, nDY-SPLITWIN_SPLITSIZEEXLN-1 ), Point( nDX-3, nDY-SPLITWIN_SPLITSIZEEXLN-1 ) );
|
|
|
|
pWin->SetLineColor( rStyleSettings.GetLightColor() );
|
|
|
|
pWin->DrawLine( Point( 1, nDY-SPLITWIN_SPLITSIZEEXLN ), Point( nDX-4, nDY-SPLITWIN_SPLITSIZEEXLN ) );
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_BOTTOM:
|
2005-01-31 12:25:46 +00:00
|
|
|
pWin->SetLineColor( rStyleSettings.GetShadowColor() );
|
|
|
|
pWin->DrawLine( Point( 0, SPLITWIN_SPLITSIZEEXLN-1 ), Point( nDX-3, SPLITWIN_SPLITSIZEEXLN-1 ) );
|
|
|
|
pWin->SetLineColor( rStyleSettings.GetLightColor() );
|
|
|
|
pWin->DrawLine( Point( 1, SPLITWIN_SPLITSIZEEXLN ), Point( nDX-4, SPLITWIN_SPLITSIZEEXLN ) );
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, sal_uInt16 nId )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( pSet->mnId == nId )
|
|
|
|
return pSet;
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
|
|
|
sal_uInt16 nItems = pSet->mnItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSplitItem* pItems = pSet->mpItems;
|
|
|
|
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mnId == nId )
|
|
|
|
return pItems[i].mpSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mpSet )
|
|
|
|
{
|
|
|
|
ImplSplitSet* pFindSet = ImplFindSet( pItems[i].mpSet, nId );
|
|
|
|
if ( pFindSet )
|
|
|
|
return pFindSet;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, sal_uInt16 nId, sal_uInt16& rPos )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
|
|
|
sal_uInt16 nItems = pSet->mnItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSplitItem* pItems = pSet->mpItems;
|
|
|
|
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mnId == nId )
|
|
|
|
{
|
|
|
|
rPos = i;
|
|
|
|
return pSet;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mpSet )
|
|
|
|
{
|
|
|
|
ImplSplitSet* pFindSet = ImplFindItem( pItems[i].mpSet, nId, rPos );
|
|
|
|
if ( pFindSet )
|
|
|
|
return pFindSet;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, Window* pWindow )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
|
|
|
sal_uInt16 nItems = pSet->mnItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSplitItem* pItems = pSet->mpItems;
|
|
|
|
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mpWindow == pWindow )
|
|
|
|
return pItems[i].mnId;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( pItems[i].mpSet )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nId = ImplFindItem( pItems[i].mpSet, pWindow );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nId )
|
|
|
|
return nId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, const Point& rPos,
|
|
|
|
sal_Bool bRows, sal_Bool bDown = sal_True )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
|
|
|
sal_uInt16 nItems = pSet->mnItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSplitItem* pItems = pSet->mpItems;
|
|
|
|
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mnWidth && pItems[i].mnHeight )
|
|
|
|
{
|
|
|
|
// Wegen ICC auftrennen
|
|
|
|
Point aPoint( pItems[i].mnLeft, pItems[i].mnTop );
|
|
|
|
Size aSize( pItems[i].mnWidth, pItems[i].mnHeight );
|
|
|
|
Rectangle aRect( aPoint, aSize );
|
|
|
|
if ( bRows )
|
|
|
|
{
|
|
|
|
if ( bDown )
|
|
|
|
aRect.Bottom() += pSet->mnSplitSize;
|
|
|
|
else
|
|
|
|
aRect.Top() -= pSet->mnSplitSize;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( bDown )
|
|
|
|
aRect.Right() += pSet->mnSplitSize;
|
|
|
|
else
|
|
|
|
aRect.Left() -= pSet->mnSplitSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( aRect.IsInside( rPos ) )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mpSet && pItems[i].mpSet->mpItems )
|
|
|
|
{
|
|
|
|
return ImplFindItem( pItems[i].mpSet, rPos,
|
|
|
|
((pItems[i].mnBits & SWIB_COLSET) == 0) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return pItems[i].mnId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void ImplDeleteSet( ImplSplitSet* pSet )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
|
|
|
sal_uInt16 nItems = pSet->mnItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSplitItem* pItems = pSet->mpItems;
|
|
|
|
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mpSet )
|
|
|
|
ImplDeleteSet( pItems[i].mpSet );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pSet->mpWallpaper )
|
|
|
|
delete pSet->mpWallpaper;
|
|
|
|
|
|
|
|
if ( pSet->mpBitmap )
|
|
|
|
delete pSet->mpBitmap;
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
delete [] pItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
delete pSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void ImplCalcSet( ImplSplitSet* pSet,
|
|
|
|
long nSetLeft, long nSetTop,
|
|
|
|
long nSetWidth, long nSetHeight,
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bRows, sal_Bool bDown = sal_True )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( !pSet->mpItems )
|
|
|
|
return;
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
|
|
|
sal_uInt16 j;
|
|
|
|
sal_uInt16 nMins;
|
|
|
|
sal_uInt16 nCalcItems;
|
|
|
|
sal_uInt16 nItems = pSet->mnItems;
|
|
|
|
sal_uInt16 nVisItems;
|
|
|
|
sal_uInt16 nAbsItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
long nCalcSize;
|
|
|
|
long nSizeDelta;
|
|
|
|
long nCurSize;
|
|
|
|
long nSizeWinSize;
|
|
|
|
long nNewSizeWinSize;
|
|
|
|
long nTemp;
|
|
|
|
long nTempErr;
|
|
|
|
long nErrorSum;
|
|
|
|
long nCurSizeDelta;
|
|
|
|
long nPos;
|
|
|
|
long nMaxPos;
|
|
|
|
long* pSize;
|
|
|
|
ImplSplitItem* pItems = pSet->mpItems;
|
2013-06-21 21:40:18 +09:00
|
|
|
bool bEmpty;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Anzahl sichtbarer Items ermitteln
|
|
|
|
nVisItems = 0;
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
|
|
|
|
nVisItems++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Groessen berechnen
|
|
|
|
if ( bRows )
|
|
|
|
nCalcSize = nSetHeight;
|
|
|
|
else
|
|
|
|
nCalcSize = nSetWidth;
|
|
|
|
nCalcSize -= (nVisItems-1)*pSet->mnSplitSize;
|
|
|
|
nCurSize = 0;
|
|
|
|
if ( pSet->mbCalcPix || (pSet->mnLastSize != nCalcSize) )
|
|
|
|
{
|
|
|
|
long nPercentFactor = 10;
|
|
|
|
long nRelCount = 0;
|
|
|
|
long nPercent = 0;
|
|
|
|
long nRelPercent = 0;
|
|
|
|
long nAbsSize = 0;
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
|
|
|
|
nRelCount += pItems[i].mnSize;
|
|
|
|
else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
|
|
|
|
nPercent += pItems[i].mnSize;
|
|
|
|
else
|
|
|
|
nAbsSize += pItems[i].mnSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Relative-Werte auf prozentual mappen (Percent bei uns 10tel Prozent)
|
|
|
|
nPercent *= nPercentFactor;
|
|
|
|
if ( nRelCount )
|
|
|
|
{
|
|
|
|
long nRelPercentBase = 1000;
|
|
|
|
while ( (nRelCount > nRelPercentBase) && (nPercentFactor < 100000) )
|
|
|
|
{
|
|
|
|
nRelPercentBase *= 10;
|
|
|
|
nPercentFactor *= 10;
|
|
|
|
}
|
|
|
|
if ( nPercent < nRelPercentBase )
|
|
|
|
{
|
|
|
|
nRelPercent = (nRelPercentBase-nPercent)/nRelCount;
|
|
|
|
nPercent += nRelPercent*nRelCount;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
nRelPercent = 0;
|
|
|
|
}
|
|
|
|
if ( !nPercent )
|
|
|
|
nPercent = 1;
|
|
|
|
nSizeDelta = nCalcSize-nAbsSize;
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mnBits & SWIB_INVISIBLE )
|
|
|
|
pItems[i].mnPixSize = 0;
|
|
|
|
else if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
|
|
|
|
{
|
|
|
|
if ( nSizeDelta <= 0 )
|
|
|
|
pItems[i].mnPixSize = 0;
|
|
|
|
else
|
|
|
|
pItems[i].mnPixSize = (nSizeDelta*pItems[i].mnSize*nRelPercent)/nPercent;
|
|
|
|
}
|
|
|
|
else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
|
|
|
|
{
|
|
|
|
if ( nSizeDelta <= 0 )
|
|
|
|
pItems[i].mnPixSize = 0;
|
|
|
|
else
|
|
|
|
pItems[i].mnPixSize = (nSizeDelta*pItems[i].mnSize*nPercentFactor)/nPercent;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pItems[i].mnPixSize = pItems[i].mnSize;
|
|
|
|
nCurSize += pItems[i].mnPixSize;
|
|
|
|
}
|
|
|
|
|
2013-06-21 21:40:18 +09:00
|
|
|
pSet->mbCalcPix = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
pSet->mnLastSize = nCalcSize;
|
|
|
|
|
|
|
|
// Fenster einpassen
|
|
|
|
nSizeDelta = nCalcSize-nCurSize;
|
|
|
|
if ( nSizeDelta )
|
|
|
|
{
|
|
|
|
nAbsItems = 0;
|
|
|
|
nSizeWinSize = 0;
|
|
|
|
nNewSizeWinSize = 0;
|
|
|
|
|
|
|
|
// Zuerst die absoluten Items relativ resizen
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
|
|
|
|
{
|
|
|
|
if ( !(pItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) )
|
|
|
|
{
|
|
|
|
nAbsItems++;
|
|
|
|
nSizeWinSize += pItems[i].mnPixSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Rundungsfehler werden hier nicht ausgelichen
|
2013-04-11 00:21:40 -03:00
|
|
|
if ( (nAbsItems < (sal_uInt16)(std::abs( nSizeDelta ))) && nSizeWinSize )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
|
|
|
|
{
|
|
|
|
if ( !(pItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) )
|
|
|
|
{
|
|
|
|
pItems[i].mnPixSize += (nSizeDelta*pItems[i].mnPixSize)/nSizeWinSize;
|
|
|
|
nNewSizeWinSize += pItems[i].mnPixSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nSizeDelta -= nNewSizeWinSize-nSizeWinSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Jetzt die Rundunsfehler ausgleichen
|
|
|
|
j = 0;
|
|
|
|
nMins = 0;
|
|
|
|
while ( nSizeDelta && (nItems != nMins) )
|
|
|
|
{
|
|
|
|
// Feststellen, welche Items berechnet werden duerfen
|
|
|
|
nCalcItems = 0;
|
|
|
|
while ( !nCalcItems )
|
|
|
|
{
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
2013-06-21 21:40:18 +09:00
|
|
|
pItems[i].mbSubSize = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( j >= 2 )
|
2013-06-21 21:40:18 +09:00
|
|
|
pItems[i].mbSubSize = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
|
|
|
|
{
|
|
|
|
if ( (nSizeDelta > 0) || pItems[i].mnPixSize )
|
|
|
|
{
|
|
|
|
if ( j >= 1 )
|
2013-06-21 21:40:18 +09:00
|
|
|
pItems[i].mbSubSize = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( (j == 0) && (pItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) )
|
2013-06-21 21:40:18 +09:00
|
|
|
pItems[i].mbSubSize = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pItems[i].mbSubSize )
|
|
|
|
nCalcItems++;
|
|
|
|
}
|
|
|
|
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Groessen von den einzelnen Items abziehen
|
|
|
|
nErrorSum = nSizeDelta % nCalcItems;
|
|
|
|
nCurSizeDelta = nSizeDelta / nCalcItems;
|
|
|
|
nMins = 0;
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mnBits & SWIB_INVISIBLE )
|
|
|
|
nMins++;
|
|
|
|
else if ( pItems[i].mbSubSize )
|
|
|
|
{
|
|
|
|
pSize = &(pItems[i].mnPixSize);
|
|
|
|
|
|
|
|
if ( nErrorSum )
|
|
|
|
{
|
|
|
|
if ( nErrorSum < 0 )
|
|
|
|
nTempErr = -1;
|
|
|
|
else
|
|
|
|
nTempErr = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
nTempErr = 0;
|
|
|
|
|
|
|
|
if ( (*pSize+nCurSizeDelta+nTempErr) <= 0 )
|
|
|
|
{
|
|
|
|
nTemp = *pSize;
|
|
|
|
if ( nTemp )
|
|
|
|
{
|
|
|
|
*pSize -= nTemp;
|
|
|
|
nSizeDelta += nTemp;
|
|
|
|
}
|
|
|
|
nMins++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*pSize += nCurSizeDelta;
|
|
|
|
nSizeDelta -= nCurSizeDelta;
|
|
|
|
if ( nTempErr && (*pSize || (nTempErr > 0)) )
|
|
|
|
{
|
|
|
|
*pSize += nTempErr;
|
|
|
|
nSizeDelta -= nTempErr;
|
|
|
|
nErrorSum -= nTempErr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
|
|
|
|
nCurSize += pItems[i].mnPixSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Maximale Groesse berechnen
|
|
|
|
if ( bRows )
|
|
|
|
{
|
|
|
|
nPos = nSetTop;
|
|
|
|
if ( !bDown )
|
|
|
|
nMaxPos = nSetTop-nSetHeight;
|
|
|
|
else
|
|
|
|
nMaxPos = nSetTop+nSetHeight;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nPos = nSetLeft;
|
|
|
|
if ( !bDown )
|
|
|
|
nMaxPos = nSetLeft-nSetWidth;
|
|
|
|
else
|
|
|
|
nMaxPos = nSetLeft+nSetWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fenster anordnen und Werte anpassen
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
pItems[i].mnOldSplitPos = pItems[i].mnSplitPos;
|
|
|
|
pItems[i].mnOldSplitSize = pItems[i].mnSplitSize;
|
|
|
|
pItems[i].mnOldWidth = pItems[i].mnWidth;
|
|
|
|
pItems[i].mnOldHeight = pItems[i].mnHeight;
|
|
|
|
|
|
|
|
if ( pItems[i].mnBits & SWIB_INVISIBLE )
|
2013-06-21 21:40:18 +09:00
|
|
|
bEmpty = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
2013-06-21 21:40:18 +09:00
|
|
|
bEmpty = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( bDown )
|
|
|
|
{
|
|
|
|
if ( nPos+pItems[i].mnPixSize > nMaxPos )
|
2013-06-21 21:40:18 +09:00
|
|
|
bEmpty = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nPos -= pItems[i].mnPixSize;
|
|
|
|
if ( nPos < nMaxPos )
|
2013-06-21 21:40:18 +09:00
|
|
|
bEmpty = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bEmpty )
|
|
|
|
{
|
|
|
|
pItems[i].mnWidth = 0;
|
|
|
|
pItems[i].mnHeight = 0;
|
|
|
|
pItems[i].mnSplitSize = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( bRows )
|
|
|
|
{
|
|
|
|
pItems[i].mnLeft = nSetLeft;
|
|
|
|
pItems[i].mnTop = nPos;
|
|
|
|
pItems[i].mnWidth = nSetWidth;
|
|
|
|
pItems[i].mnHeight = pItems[i].mnPixSize;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pItems[i].mnLeft = nPos;
|
|
|
|
pItems[i].mnTop = nSetTop;
|
|
|
|
pItems[i].mnWidth = pItems[i].mnPixSize;
|
|
|
|
pItems[i].mnHeight = nSetHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( i > nItems-1 )
|
|
|
|
pItems[i].mnSplitSize = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pItems[i].mnSplitSize = pSet->mnSplitSize;
|
|
|
|
if ( bDown )
|
|
|
|
{
|
|
|
|
pItems[i].mnSplitPos = nPos+pItems[i].mnPixSize;
|
|
|
|
if ( pItems[i].mnSplitPos+pItems[i].mnSplitSize > nMaxPos )
|
|
|
|
pItems[i].mnSplitSize = nMaxPos-pItems[i].mnSplitPos;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pItems[i].mnSplitPos = nPos-pSet->mnSplitSize;
|
|
|
|
if ( pItems[i].mnSplitPos < nMaxPos )
|
|
|
|
pItems[i].mnSplitSize = pItems[i].mnSplitPos+pSet->mnSplitSize-nMaxPos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
|
|
|
|
{
|
|
|
|
if ( !bDown )
|
|
|
|
nPos -= pSet->mnSplitSize;
|
|
|
|
else
|
|
|
|
nPos += pItems[i].mnPixSize+pSet->mnSplitSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Sub-Set's berechnen
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mpSet && pItems[i].mnWidth && pItems[i].mnHeight )
|
|
|
|
{
|
|
|
|
ImplCalcSet( pItems[i].mpSet,
|
|
|
|
pItems[i].mnLeft, pItems[i].mnTop,
|
|
|
|
pItems[i].mnWidth, pItems[i].mnHeight,
|
|
|
|
((pItems[i].mnBits & SWIB_COLSET) == 0) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fixed setzen
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
2013-06-21 21:40:18 +09:00
|
|
|
pItems[i].mbFixed = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pItems[i].mnBits & SWIB_FIXED )
|
2013-06-21 21:40:18 +09:00
|
|
|
pItems[i].mbFixed = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Wenn Child-Set vorhanden, ist dieses Item auch Fixed, wenn
|
|
|
|
// ein Child fixed ist
|
|
|
|
if ( pItems[i].mpSet )
|
|
|
|
{
|
|
|
|
for ( j = 0; j < pItems[i].mpSet->mnItems; j++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mpSet->mpItems[j].mbFixed )
|
|
|
|
{
|
2013-06-21 21:40:18 +09:00
|
|
|
pItems[i].mbFixed = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, sal_Bool bHide,
|
|
|
|
sal_Bool bRows, sal_Bool /*bDown*/ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
|
|
|
sal_uInt16 nItems = pSet->mnItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSplitItem* pItems = pSet->mpItems;
|
|
|
|
|
|
|
|
if ( pWindow->IsReallyVisible() && pWindow->IsUpdateMode() && pWindow->mbInvalidate )
|
|
|
|
{
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mnSplitSize )
|
|
|
|
{
|
|
|
|
// Evt. alles invalidieren oder nur einen kleinen Teil
|
|
|
|
if ( (pItems[i].mnOldSplitPos != pItems[i].mnSplitPos) ||
|
|
|
|
(pItems[i].mnOldSplitSize != pItems[i].mnSplitSize) ||
|
|
|
|
(pItems[i].mnOldWidth != pItems[i].mnWidth) ||
|
|
|
|
(pItems[i].mnOldHeight != pItems[i].mnHeight) )
|
|
|
|
{
|
|
|
|
Rectangle aRect;
|
|
|
|
|
|
|
|
// Old Rect invalidieren
|
|
|
|
if ( bRows )
|
|
|
|
{
|
|
|
|
aRect.Left() = pItems[i].mnLeft;
|
|
|
|
aRect.Right() = pItems[i].mnLeft+pItems[i].mnOldWidth-1;
|
|
|
|
aRect.Top() = pItems[i].mnOldSplitPos;
|
|
|
|
aRect.Bottom() = aRect.Top() + pItems[i].mnOldSplitSize;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aRect.Top() = pItems[i].mnTop;
|
|
|
|
aRect.Bottom() = pItems[i].mnTop+pItems[i].mnOldHeight-1;
|
|
|
|
aRect.Left() = pItems[i].mnOldSplitPos;
|
|
|
|
aRect.Right() = aRect.Left() + pItems[i].mnOldSplitSize;
|
|
|
|
}
|
|
|
|
pWindow->Invalidate( aRect );
|
|
|
|
// New Rect invalidieren
|
|
|
|
if ( bRows )
|
|
|
|
{
|
|
|
|
aRect.Left() = pItems[i].mnLeft;
|
|
|
|
aRect.Right() = pItems[i].mnLeft+pItems[i].mnWidth-1;
|
|
|
|
aRect.Top() = pItems[i].mnSplitPos;
|
|
|
|
aRect.Bottom() = aRect.Top() + pItems[i].mnSplitSize;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aRect.Top() = pItems[i].mnTop;
|
|
|
|
aRect.Bottom() = pItems[i].mnTop+pItems[i].mnHeight-1;
|
|
|
|
aRect.Left() = pItems[i].mnSplitPos;
|
|
|
|
aRect.Right() = aRect.Left() + pItems[i].mnSplitSize;
|
|
|
|
}
|
|
|
|
pWindow->Invalidate( aRect );
|
|
|
|
|
|
|
|
// Leere Sets komplett invalidieren, da diese Flaechen
|
|
|
|
// nicht von Fenstern ueberladen werden
|
|
|
|
if ( pItems[i].mpSet && !pItems[i].mpSet->mpItems )
|
|
|
|
{
|
|
|
|
aRect.Left() = pItems[i].mnLeft;
|
|
|
|
aRect.Top() = pItems[i].mnTop;
|
|
|
|
aRect.Right() = pItems[i].mnLeft+pItems[i].mnWidth-1;
|
|
|
|
aRect.Bottom() = pItems[i].mnTop+pItems[i].mnHeight-1;
|
|
|
|
pWindow->Invalidate( aRect );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fenster positionieren
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mpSet )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bTempHide = bHide;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !pItems[i].mnWidth || !pItems[i].mnHeight )
|
2010-09-29 15:46:40 +08:00
|
|
|
bTempHide = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplCalcSet2( pWindow, pItems[i].mpSet, bTempHide,
|
|
|
|
((pItems[i].mnBits & SWIB_COLSET) == 0) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( pItems[i].mnWidth && pItems[i].mnHeight && !bHide )
|
|
|
|
{
|
|
|
|
Point aPos( pItems[i].mnLeft, pItems[i].mnTop );
|
|
|
|
Size aSize( pItems[i].mnWidth, pItems[i].mnHeight );
|
|
|
|
pItems[i].mpWindow->SetPosSizePixel( aPos, aSize );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pItems[i].mpWindow->Hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fenster anzeigen und Flag zuruecksetzen
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mpWindow && pItems[i].mnWidth && pItems[i].mnHeight && !bHide )
|
|
|
|
pItems[i].mpWindow->Show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
static void ImplCalcLogSize( ImplSplitItem* pItems, sal_uInt16 nItems )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// Original-Groessen updaten
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
2000-09-18 16:07:07 +00:00
|
|
|
long nRelSize = 0;
|
|
|
|
long nPerSize = 0;
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
|
|
|
|
nRelSize += pItems[i].mnPixSize;
|
|
|
|
else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
|
|
|
|
nPerSize += pItems[i].mnPixSize;
|
|
|
|
}
|
|
|
|
nPerSize += nRelSize;
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
|
|
|
|
{
|
|
|
|
if ( nRelSize )
|
|
|
|
pItems[i].mnSize = (pItems[i].mnPixSize+(nRelSize/2))/nRelSize;
|
|
|
|
else
|
|
|
|
pItems[i].mnSize = 1;
|
|
|
|
}
|
|
|
|
else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
|
|
|
|
{
|
|
|
|
if ( nPerSize )
|
|
|
|
pItems[i].mnSize = (pItems[i].mnPixSize*100)/nPerSize;
|
|
|
|
else
|
|
|
|
pItems[i].mnSize = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pItems[i].mnSize = pItems[i].mnPixSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2005-11-01 09:34:10 +00:00
|
|
|
void SplitWindow::ImplDrawBack( SplitWindow* pWindow, const Rectangle& rRect,
|
|
|
|
const Wallpaper* pWall, const Bitmap* pBitmap )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( pBitmap )
|
|
|
|
{
|
|
|
|
Point aPos = rRect.TopLeft();
|
|
|
|
Size aBmpSize = pBitmap->GetSizePixel();
|
|
|
|
pWindow->Push( PUSH_CLIPREGION );
|
|
|
|
pWindow->IntersectClipRegion( rRect );
|
|
|
|
do
|
|
|
|
{
|
|
|
|
aPos.X() = rRect.Left();
|
|
|
|
do
|
|
|
|
{
|
|
|
|
pWindow->DrawBitmap( aPos, *pBitmap );
|
|
|
|
aPos.X() += aBmpSize.Width();
|
|
|
|
}
|
|
|
|
while ( aPos.X() < rRect.Right() );
|
|
|
|
aPos.Y() += aBmpSize.Height();
|
|
|
|
}
|
|
|
|
while ( aPos.Y() < rRect.Bottom() );
|
|
|
|
pWindow->Pop();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pWindow->DrawWallpaper( rRect, *pWall );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2005-11-01 09:34:10 +00:00
|
|
|
void SplitWindow::ImplDrawBack( SplitWindow* pWindow, ImplSplitSet* pSet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
|
|
|
sal_uInt16 nItems = pSet->mnItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSplitItem* pItems = pSet->mpItems;
|
|
|
|
|
|
|
|
// Beim Mainset auch den Hintergrund zeichnen
|
|
|
|
if ( pSet->mnId == 0 )
|
|
|
|
{
|
|
|
|
if ( pSet->mpBitmap )
|
|
|
|
{
|
|
|
|
Rectangle aRect( pWindow->mnLeftBorder,
|
|
|
|
pWindow->mnTopBorder,
|
|
|
|
pWindow->mnDX-pWindow->mnRightBorder-1,
|
|
|
|
pWindow->mnDY-pWindow->mnBottomBorder-1 );
|
|
|
|
ImplDrawBack( pWindow, aRect, pSet->mpWallpaper, pSet->mpBitmap );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
pSet = pItems[i].mpSet;
|
|
|
|
if ( pSet )
|
|
|
|
{
|
|
|
|
if ( pSet->mpBitmap || pSet->mpWallpaper )
|
|
|
|
{
|
|
|
|
// Wegen ICC auftrennen
|
|
|
|
Point aPoint( pItems[i].mnLeft, pItems[i].mnTop );
|
|
|
|
Size aSize( pItems[i].mnWidth, pItems[i].mnHeight );
|
|
|
|
Rectangle aRect( aPoint, aSize );
|
|
|
|
ImplDrawBack( pWindow, aRect, pSet->mpWallpaper, pSet->mpBitmap );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mpSet )
|
|
|
|
ImplDrawBack( pWindow, pItems[i].mpSet );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void ImplDrawSplit( SplitWindow* pWindow, ImplSplitSet* pSet,
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bRows, sal_Bool bDown = sal_True )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( !pSet->mpItems )
|
|
|
|
return;
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
|
|
|
sal_uInt16 nItems = pSet->mnItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
long nPos;
|
|
|
|
long nTop;
|
|
|
|
long nBottom;
|
|
|
|
ImplSplitItem* pItems = pSet->mpItems;
|
|
|
|
const StyleSettings& rStyleSettings = pWindow->GetSettings().GetStyleSettings();
|
|
|
|
|
2013-06-21 21:40:18 +09:00
|
|
|
bool bFlat = (pWindow->GetStyle() & WB_FLATSPLITDRAW) == WB_FLATSPLITDRAW;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
for ( i = 0; i < nItems-1; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mnSplitSize )
|
|
|
|
{
|
|
|
|
nPos = pItems[i].mnSplitPos;
|
|
|
|
|
|
|
|
long nItemSplitSize = pItems[i].mnSplitSize;
|
|
|
|
long nSplitSize = pSet->mnSplitSize;
|
|
|
|
if ( bRows )
|
|
|
|
{
|
|
|
|
nTop = pItems[i].mnLeft;
|
|
|
|
nBottom = pItems[i].mnLeft+pItems[i].mnWidth-1;
|
|
|
|
|
|
|
|
if ( bFlat ) nPos--;
|
|
|
|
|
|
|
|
if ( bDown || (nItemSplitSize >= nSplitSize) )
|
|
|
|
{
|
|
|
|
pWindow->SetLineColor( rStyleSettings.GetLightColor() );
|
|
|
|
pWindow->DrawLine( Point( nTop, nPos+1 ), Point( nBottom, nPos+1 ) );
|
|
|
|
}
|
|
|
|
nPos += nSplitSize-2;
|
|
|
|
if ( bFlat ) nPos+=2;
|
|
|
|
if ( (!bDown && (nItemSplitSize >= 2)) ||
|
|
|
|
(bDown && (nItemSplitSize >= nSplitSize-1)) )
|
|
|
|
{
|
|
|
|
pWindow->SetLineColor( rStyleSettings.GetShadowColor() );
|
|
|
|
pWindow->DrawLine( Point( nTop, nPos ), Point( nBottom, nPos ) );
|
|
|
|
}
|
|
|
|
if ( !bFlat )
|
|
|
|
{
|
|
|
|
nPos++;
|
|
|
|
if ( !bDown || (nItemSplitSize >= nSplitSize) )
|
|
|
|
{
|
|
|
|
pWindow->SetLineColor( rStyleSettings.GetDarkShadowColor() );
|
|
|
|
pWindow->DrawLine( Point( nTop, nPos ), Point( nBottom, nPos ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nTop = pItems[i].mnTop;
|
|
|
|
nBottom = pItems[i].mnTop+pSet->mpItems[i].mnHeight-1;
|
|
|
|
|
|
|
|
if ( bFlat ) nPos--;
|
|
|
|
if ( bDown || (nItemSplitSize >= nSplitSize) )
|
|
|
|
{
|
|
|
|
pWindow->SetLineColor( rStyleSettings.GetLightColor() );
|
|
|
|
pWindow->DrawLine( Point( nPos+1, nTop ), Point( nPos+1, nBottom ) );
|
|
|
|
}
|
|
|
|
nPos += pSet->mnSplitSize-2;
|
|
|
|
if ( bFlat ) nPos+=2;
|
|
|
|
if ( (!bDown && (nItemSplitSize >= 2)) ||
|
|
|
|
(bDown && (nItemSplitSize >= nSplitSize-1)) )
|
|
|
|
{
|
|
|
|
pWindow->SetLineColor( rStyleSettings.GetShadowColor() );
|
|
|
|
pWindow->DrawLine( Point( nPos, nTop ), Point( nPos, nBottom ) );
|
|
|
|
}
|
|
|
|
if( !bFlat )
|
|
|
|
{
|
|
|
|
nPos++;
|
|
|
|
if ( !bDown || (nItemSplitSize >= nSplitSize) )
|
|
|
|
{
|
|
|
|
pWindow->SetLineColor( rStyleSettings.GetDarkShadowColor() );
|
|
|
|
pWindow->DrawLine( Point( nPos, nTop ), Point( nPos, nBottom ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mpSet && pItems[i].mnWidth && pItems[i].mnHeight )
|
|
|
|
ImplDrawSplit( pWindow, pItems[i].mpSet, ((pItems[i].mnBits & SWIB_COLSET) == 0) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos,
|
|
|
|
long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos,
|
|
|
|
sal_Bool bRows, sal_Bool /*bDown*/ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( !pSet->mpItems )
|
|
|
|
return 0;
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
|
|
|
sal_uInt16 nSplitTest;
|
|
|
|
sal_uInt16 nItems = pSet->mnItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
long nMPos1;
|
|
|
|
long nMPos2;
|
|
|
|
long nPos;
|
|
|
|
long nTop;
|
|
|
|
long nBottom;
|
|
|
|
ImplSplitItem* pItems = pSet->mpItems;
|
|
|
|
|
|
|
|
if ( bRows )
|
|
|
|
{
|
|
|
|
nMPos1 = rPos.X();
|
|
|
|
nMPos2 = rPos.Y();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nMPos1 = rPos.Y();
|
|
|
|
nMPos2 = rPos.X();
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( i = 0; i < nItems-1; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mnSplitSize )
|
|
|
|
{
|
|
|
|
if ( bRows )
|
|
|
|
{
|
|
|
|
nTop = pItems[i].mnLeft;
|
|
|
|
nBottom = pItems[i].mnLeft+pItems[i].mnWidth-1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nTop = pItems[i].mnTop;
|
|
|
|
nBottom = pItems[i].mnTop+pItems[i].mnHeight-1;
|
|
|
|
}
|
|
|
|
nPos = pItems[i].mnSplitPos;
|
|
|
|
|
|
|
|
if ( (nMPos1 >= nTop) && (nMPos1 <= nBottom) &&
|
|
|
|
(nMPos2 >= nPos) && (nMPos2 <= nPos+pItems[i].mnSplitSize) )
|
|
|
|
{
|
|
|
|
if ( !pItems[i].mbFixed && !pItems[i+1].mbFixed )
|
|
|
|
{
|
|
|
|
rMouseOff = nMPos2-nPos;
|
|
|
|
*ppFoundSet = pSet;
|
|
|
|
rFoundPos = i;
|
|
|
|
if ( bRows )
|
|
|
|
return SPLIT_VERT;
|
|
|
|
else
|
|
|
|
return SPLIT_HORZ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return SPLIT_NOSPLIT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mpSet )
|
|
|
|
{
|
|
|
|
nSplitTest = ImplTestSplit( pItems[i].mpSet, rPos,
|
|
|
|
rMouseOff, ppFoundSet, rFoundPos,
|
|
|
|
((pItems[i].mnBits & SWIB_COLSET) == 0) );
|
|
|
|
if ( nSplitTest )
|
|
|
|
return nSplitTest;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 SplitWindow::ImplTestSplit( SplitWindow* pWindow, const Point& rPos,
|
|
|
|
long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-03-03 12:45:21 +01:00
|
|
|
// Resizable SplitWindow muss anders behandelt werden
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pWindow->mnWinStyle & WB_SIZEABLE )
|
|
|
|
{
|
|
|
|
long nTPos;
|
|
|
|
long nPos;
|
|
|
|
long nBorder;
|
|
|
|
|
|
|
|
if ( pWindow->mbHorz )
|
|
|
|
{
|
|
|
|
if ( pWindow->mbBottomRight )
|
|
|
|
{
|
|
|
|
nBorder = pWindow->mnBottomBorder;
|
|
|
|
nPos = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nBorder = pWindow->mnTopBorder;
|
|
|
|
nPos = pWindow->mnDY-nBorder;
|
|
|
|
}
|
|
|
|
nTPos = rPos.Y();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( pWindow->mbBottomRight )
|
|
|
|
{
|
|
|
|
nBorder = pWindow->mnRightBorder;
|
|
|
|
nPos = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nBorder = pWindow->mnLeftBorder;
|
|
|
|
nPos = pWindow->mnDX-nBorder;
|
|
|
|
}
|
|
|
|
nTPos = rPos.X();
|
|
|
|
}
|
|
|
|
long nSplitSize = pWindow->mpMainSet->mnSplitSize-2;
|
|
|
|
if ( pWindow->mbAutoHide || pWindow->mbFadeOut )
|
2005-01-31 12:25:46 +00:00
|
|
|
nSplitSize += SPLITWIN_SPLITSIZEEXLN;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !pWindow->mbBottomRight )
|
|
|
|
nPos -= nSplitSize;
|
|
|
|
if ( (nTPos >= nPos) && (nTPos <= nPos+nSplitSize+nBorder) )
|
|
|
|
{
|
|
|
|
rMouseOff = nTPos-nPos;
|
|
|
|
*ppFoundSet = pWindow->mpMainSet;
|
|
|
|
if ( pWindow->mpMainSet->mpItems )
|
|
|
|
rFoundPos = pWindow->mpMainSet->mnItems-1;
|
|
|
|
else
|
|
|
|
rFoundPos = 0;
|
|
|
|
if ( pWindow->mbHorz )
|
|
|
|
return SPLIT_VERT | SPLIT_WINDOW;
|
|
|
|
else
|
|
|
|
return SPLIT_HORZ | SPLIT_WINDOW;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ImplTestSplit( pWindow->mpMainSet, rPos, rMouseOff, ppFoundSet, rFoundPos,
|
|
|
|
pWindow->mbHorz, !pWindow->mbBottomRight );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2005-11-01 09:34:10 +00:00
|
|
|
void SplitWindow::ImplDrawSplitTracking( SplitWindow* pThis, const Point& rPos )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Rectangle aRect;
|
|
|
|
|
|
|
|
if ( pThis->mnSplitTest & SPLIT_HORZ )
|
|
|
|
{
|
|
|
|
aRect.Top() = pThis->maDragRect.Top();
|
|
|
|
aRect.Bottom() = pThis->maDragRect.Bottom();
|
|
|
|
aRect.Left() = rPos.X();
|
|
|
|
aRect.Right() = aRect.Left()+pThis->mpSplitSet->mnSplitSize-1;
|
|
|
|
if ( !(pThis->mnWinStyle & WB_NOSPLITDRAW) )
|
|
|
|
aRect.Right()--;
|
|
|
|
if ( (pThis->mnSplitTest & SPLIT_WINDOW) &&
|
|
|
|
(pThis->mbAutoHide || pThis->mbFadeOut) )
|
|
|
|
{
|
2005-01-31 12:25:46 +00:00
|
|
|
aRect.Left() += SPLITWIN_SPLITSIZEEXLN;
|
|
|
|
aRect.Right() += SPLITWIN_SPLITSIZEEXLN;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aRect.Left() = pThis->maDragRect.Left();
|
|
|
|
aRect.Right() = pThis->maDragRect.Right();
|
|
|
|
aRect.Top() = rPos.Y();
|
|
|
|
aRect.Bottom() = aRect.Top()+pThis->mpSplitSet->mnSplitSize-1;
|
|
|
|
if ( !(pThis->mnWinStyle & WB_NOSPLITDRAW) )
|
|
|
|
aRect.Bottom()--;
|
|
|
|
if ( (pThis->mnSplitTest & SPLIT_WINDOW) &&
|
|
|
|
(pThis->mbAutoHide || pThis->mbFadeOut) )
|
|
|
|
{
|
2005-01-31 12:25:46 +00:00
|
|
|
aRect.Top() += SPLITWIN_SPLITSIZEEXLN;
|
|
|
|
aRect.Bottom() += SPLITWIN_SPLITSIZEEXLN;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pThis->ShowTracking( aRect, SHOWTRACK_SPLIT );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::ImplInit( Window* pParent, WinBits nStyle )
|
|
|
|
{
|
|
|
|
ImplSplitSet* pNewSet = new ImplSplitSet;
|
|
|
|
pNewSet->mpItems = NULL;
|
|
|
|
pNewSet->mpWallpaper = NULL;
|
|
|
|
pNewSet->mpBitmap = NULL;
|
|
|
|
pNewSet->mnLastSize = 0;
|
|
|
|
pNewSet->mnItems = 0;
|
|
|
|
pNewSet->mnId = 0;
|
|
|
|
pNewSet->mnSplitSize = SPLITWIN_SPLITSIZE;
|
2013-06-21 21:40:18 +09:00
|
|
|
pNewSet->mbCalcPix = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
mpMainSet = pNewSet;
|
|
|
|
mpBaseSet = pNewSet;
|
|
|
|
mpSplitSet = NULL;
|
|
|
|
mpLastSizes = NULL;
|
|
|
|
mnDX = 0;
|
|
|
|
mnDY = 0;
|
|
|
|
mnLeftBorder = 0;
|
|
|
|
mnTopBorder = 0;
|
|
|
|
mnRightBorder = 0;
|
|
|
|
mnBottomBorder = 0;
|
|
|
|
mnMaxSize = 0;
|
|
|
|
mnMouseOff = 0;
|
|
|
|
meAlign = WINDOWALIGN_TOP;
|
|
|
|
mnWinStyle = nStyle;
|
|
|
|
mnSplitTest = 0;
|
|
|
|
mnSplitPos = 0;
|
|
|
|
mnMouseModifier = 0;
|
|
|
|
mnMStartPos = 0;
|
|
|
|
mnMSplitPos = 0;
|
2010-09-29 15:46:40 +08:00
|
|
|
mbDragFull = sal_False;
|
|
|
|
mbHorz = sal_True;
|
|
|
|
mbBottomRight = sal_False;
|
|
|
|
mbCalc = sal_False;
|
|
|
|
mbRecalc = sal_True;
|
|
|
|
mbInvalidate = sal_True;
|
|
|
|
mbAutoHide = sal_False;
|
|
|
|
mbFadeIn = sal_False;
|
|
|
|
mbFadeOut = sal_False;
|
|
|
|
mbAutoHideIn = sal_False;
|
|
|
|
mbAutoHideDown = sal_False;
|
|
|
|
mbFadeInDown = sal_False;
|
|
|
|
mbFadeOutDown = sal_False;
|
|
|
|
mbAutoHidePressed = sal_False;
|
|
|
|
mbFadeInPressed = sal_False;
|
|
|
|
mbFadeOutPressed = sal_False;
|
|
|
|
mbFadeNoButtonMode = sal_False;
|
|
|
|
mbNoAlign = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( nStyle & WB_NOSPLITDRAW )
|
|
|
|
{
|
|
|
|
pNewSet->mnSplitSize -= 2;
|
2010-09-29 15:46:40 +08:00
|
|
|
mbInvalidate = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( nStyle & WB_BORDER )
|
|
|
|
{
|
|
|
|
ImplCalcBorder( meAlign, mbNoAlign, mnLeftBorder, mnTopBorder,
|
|
|
|
mnRightBorder, mnBottomBorder );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mnLeftBorder = 0;
|
|
|
|
mnTopBorder = 0;
|
|
|
|
mnRightBorder = 0;
|
|
|
|
mnBottomBorder = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DockingWindow::ImplInit( pParent, (nStyle | WB_CLIPCHILDREN) & ~(WB_BORDER | WB_SIZEABLE) );
|
|
|
|
|
|
|
|
ImplInitSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::ImplInitSettings()
|
|
|
|
{
|
|
|
|
// Wenn fuer das MainSet eine Bitmap gesetzt wird, dann
|
|
|
|
// brauchen wir nicht mehr den Hintergrund loeschen
|
|
|
|
// Wenn MainSet Wallpaper hat, dann ist das der Hintergrund, ansonsten
|
|
|
|
// sind es die Standard-Farben
|
|
|
|
if ( mpMainSet->mpBitmap )
|
|
|
|
SetBackground();
|
|
|
|
else if ( mpMainSet->mpWallpaper )
|
|
|
|
SetBackground( *mpMainSet->mpWallpaper );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
|
|
|
|
|
|
|
|
Color aColor;
|
|
|
|
if ( IsControlBackground() )
|
|
|
|
aColor = GetControlBackground();
|
|
|
|
else if ( Window::GetStyle() & WB_3DLOOK )
|
|
|
|
aColor = rStyleSettings.GetFaceColor();
|
|
|
|
else
|
|
|
|
aColor = rStyleSettings.GetWindowColor();
|
|
|
|
SetBackground( aColor );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
|
|
|
SplitWindow::SplitWindow( Window* pParent, WinBits nStyle ) :
|
|
|
|
DockingWindow( WINDOW_SPLITWINDOW )
|
|
|
|
{
|
|
|
|
ImplInit( pParent, nStyle );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
SplitWindow::~SplitWindow()
|
|
|
|
{
|
|
|
|
// Sets loeschen
|
|
|
|
ImplDeleteSet( mpMainSet );
|
2011-08-05 15:45:21 +01:00
|
|
|
mpMainSet = NULL; //NULL for base-class callbacks during dtoring
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::ImplSetWindowSize( long nDelta )
|
|
|
|
{
|
|
|
|
if ( !nDelta )
|
|
|
|
return;
|
|
|
|
|
|
|
|
Size aSize = GetSizePixel();
|
2012-02-18 14:18:19 +01:00
|
|
|
switch ( meAlign )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-02-18 14:18:19 +01:00
|
|
|
case WINDOWALIGN_TOP:
|
2000-09-18 16:07:07 +00:00
|
|
|
aSize.Height() += nDelta;
|
|
|
|
SetSizePixel( aSize );
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_BOTTOM:
|
2012-02-18 22:24:11 +04:00
|
|
|
{
|
2002-08-28 08:13:50 +00:00
|
|
|
maDragRect.Top() += nDelta;
|
2000-09-18 16:07:07 +00:00
|
|
|
Point aPos = GetPosPixel();
|
|
|
|
aPos.Y() -= nDelta;
|
|
|
|
aSize.Height() += nDelta;
|
|
|
|
SetPosSizePixel( aPos, aSize );
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
2012-02-18 22:24:11 +04:00
|
|
|
}
|
2012-02-18 14:18:19 +01:00
|
|
|
case WINDOWALIGN_LEFT:
|
2000-09-18 16:07:07 +00:00
|
|
|
aSize.Width() += nDelta;
|
|
|
|
SetSizePixel( aSize );
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_RIGHT:
|
|
|
|
default:
|
2012-02-18 20:08:38 +00:00
|
|
|
{
|
2002-08-28 08:13:50 +00:00
|
|
|
maDragRect.Left() += nDelta;
|
2000-09-18 16:07:07 +00:00
|
|
|
Point aPos = GetPosPixel();
|
|
|
|
aPos.X() -= nDelta;
|
|
|
|
aSize.Width() += nDelta;
|
|
|
|
SetPosSizePixel( aPos, aSize );
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2012-02-18 20:08:38 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
SplitResize();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
Size SplitWindow::CalcLayoutSizePixel( const Size& aNewSize )
|
|
|
|
{
|
|
|
|
Size aSize( aNewSize );
|
|
|
|
long nSplitSize = mpMainSet->mnSplitSize-2;
|
|
|
|
|
|
|
|
if ( mbAutoHide || mbFadeOut )
|
2005-01-31 12:25:46 +00:00
|
|
|
nSplitSize += SPLITWIN_SPLITSIZEEXLN;
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
// Wenn Fenster sizeable ist, wird die groesse automatisch nach
|
|
|
|
// dem MainSet festgelegt, wenn kein relatives Fenster enthalten
|
|
|
|
// ist
|
|
|
|
if ( mnWinStyle & WB_SIZEABLE )
|
|
|
|
{
|
|
|
|
long nCurSize;
|
|
|
|
long nCalcSize = 0;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
for ( i = 0; i < mpMainSet->mnItems; i++ )
|
|
|
|
{
|
|
|
|
if ( mpMainSet->mpItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE) )
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
nCalcSize += mpMainSet->mpItems[i].mnSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( i == mpMainSet->mnItems )
|
|
|
|
{
|
|
|
|
long nDelta = 0;
|
|
|
|
Point aPos = GetPosPixel();
|
|
|
|
|
|
|
|
if ( mbHorz )
|
|
|
|
nCurSize = aNewSize.Height()-mnTopBorder-mnBottomBorder;
|
|
|
|
else
|
|
|
|
nCurSize = aNewSize.Width()-mnLeftBorder-mnRightBorder;
|
|
|
|
nCurSize -= nSplitSize;
|
|
|
|
nCurSize -= (mpMainSet->mnItems-1)*mpMainSet->mnSplitSize;
|
|
|
|
|
|
|
|
nDelta = nCalcSize-nCurSize;
|
|
|
|
if ( !nDelta )
|
|
|
|
return aSize;
|
|
|
|
|
2012-02-18 14:18:19 +01:00
|
|
|
switch ( meAlign )
|
2003-03-27 16:59:30 +00:00
|
|
|
{
|
2012-02-18 14:18:19 +01:00
|
|
|
case WINDOWALIGN_TOP:
|
2003-03-27 16:59:30 +00:00
|
|
|
aSize.Height() += nDelta;
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_BOTTOM:
|
2003-03-27 16:59:30 +00:00
|
|
|
aPos.Y() -= nDelta;
|
|
|
|
aSize.Height() += nDelta;
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_LEFT:
|
2003-03-27 16:59:30 +00:00
|
|
|
aSize.Width() += nDelta;
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_RIGHT:
|
|
|
|
default:
|
2003-03-27 16:59:30 +00:00
|
|
|
aPos.X() -= nDelta;
|
|
|
|
aSize.Width() += nDelta;
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
2003-03-27 16:59:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void SplitWindow::ImplCalcLayout()
|
|
|
|
{
|
|
|
|
if ( !mbCalc || !mbRecalc || !mpMainSet->mpItems )
|
|
|
|
return;
|
|
|
|
|
|
|
|
long nSplitSize = mpMainSet->mnSplitSize-2;
|
|
|
|
if ( mbAutoHide || mbFadeOut )
|
2005-01-31 12:25:46 +00:00
|
|
|
nSplitSize += SPLITWIN_SPLITSIZEEXLN;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Wenn Fenster sizeable ist, wird die groesse automatisch nach
|
|
|
|
// dem MainSet festgelegt, wenn kein relatives Fenster enthalten
|
|
|
|
// ist
|
|
|
|
if ( mnWinStyle & WB_SIZEABLE )
|
|
|
|
{
|
|
|
|
long nCurSize;
|
|
|
|
long nCalcSize = 0;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
for ( i = 0; i < mpMainSet->mnItems; i++ )
|
|
|
|
{
|
|
|
|
if ( mpMainSet->mpItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE) )
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
nCalcSize += mpMainSet->mpItems[i].mnSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( i == mpMainSet->mnItems )
|
|
|
|
{
|
|
|
|
if ( mbHorz )
|
|
|
|
nCurSize = mnDY-mnTopBorder-mnBottomBorder;
|
|
|
|
else
|
|
|
|
nCurSize = mnDX-mnLeftBorder-mnRightBorder;
|
|
|
|
nCurSize -= nSplitSize;
|
|
|
|
nCurSize -= (mpMainSet->mnItems-1)*mpMainSet->mnSplitSize;
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
mbRecalc = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSetWindowSize( nCalcSize-nCurSize );
|
2010-09-29 15:46:40 +08:00
|
|
|
mbRecalc = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( (mnDX <= 0) || (mnDY <= 0) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Groessen/Position vorberechnen
|
|
|
|
long nL;
|
|
|
|
long nT;
|
|
|
|
long nW;
|
|
|
|
long nH;
|
|
|
|
|
|
|
|
if ( mbHorz )
|
|
|
|
{
|
|
|
|
if ( mbBottomRight )
|
|
|
|
nT = mnDY-mnBottomBorder;
|
|
|
|
else
|
|
|
|
nT = mnTopBorder;
|
|
|
|
nL = mnLeftBorder;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( mbBottomRight )
|
|
|
|
nL = mnDX-mnRightBorder;
|
|
|
|
else
|
|
|
|
nL = mnLeftBorder;
|
|
|
|
nT = mnTopBorder;
|
|
|
|
}
|
|
|
|
nW = mnDX-mnLeftBorder-mnRightBorder;
|
|
|
|
nH = mnDY-mnTopBorder-mnBottomBorder;
|
|
|
|
if ( mnWinStyle & WB_SIZEABLE )
|
|
|
|
{
|
|
|
|
if ( mbHorz )
|
|
|
|
nH -= nSplitSize;
|
|
|
|
else
|
|
|
|
nW -= nSplitSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Sets rekursiv berechnen
|
|
|
|
ImplCalcSet( mpMainSet, nL, nT, nW, nH, mbHorz, !mbBottomRight );
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplCalcSet2( this, mpMainSet, sal_False, mbHorz, !mbBottomRight );
|
|
|
|
mbCalc = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::ImplUpdate()
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbCalc = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( IsReallyShown() && IsUpdateMode() && mbRecalc )
|
|
|
|
{
|
|
|
|
if ( mpMainSet->mpItems )
|
|
|
|
ImplCalcLayout();
|
|
|
|
else
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::ImplSplitMousePos( Point& rMousePos )
|
|
|
|
{
|
|
|
|
if ( mnSplitTest & SPLIT_HORZ )
|
|
|
|
{
|
|
|
|
rMousePos.X() -= mnMouseOff;
|
|
|
|
if ( rMousePos.X() < maDragRect.Left() )
|
|
|
|
rMousePos.X() = maDragRect.Left();
|
|
|
|
else if ( rMousePos.X()+mpSplitSet->mnSplitSize+1 > maDragRect.Right() )
|
|
|
|
rMousePos.X() = maDragRect.Right()-mpSplitSet->mnSplitSize+1;
|
|
|
|
// Wegen FullDrag in Screen-Koordinaaten merken
|
|
|
|
mnMSplitPos = OutputToScreenPixel( rMousePos ).X();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rMousePos.Y() -= mnMouseOff;
|
|
|
|
if ( rMousePos.Y() < maDragRect.Top() )
|
|
|
|
rMousePos.Y() = maDragRect.Top();
|
|
|
|
else if ( rMousePos.Y()+mpSplitSet->mnSplitSize+1 > maDragRect.Bottom() )
|
|
|
|
rMousePos.Y() = maDragRect.Bottom()-mpSplitSet->mnSplitSize+1;
|
|
|
|
mnMSplitPos = OutputToScreenPixel( rMousePos ).Y();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::ImplGetButtonRect( Rectangle& rRect, long nEx, sal_Bool bTest ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
long nSplitSize = mpMainSet->mnSplitSize-2;
|
|
|
|
if ( mbAutoHide || mbFadeOut || mbFadeIn )
|
|
|
|
nSplitSize += SPLITWIN_SPLITSIZEEX;
|
|
|
|
|
|
|
|
long nButtonSize = 0;
|
|
|
|
if ( mbFadeIn )
|
|
|
|
nButtonSize += SPLITWIN_SPLITSIZEFADE+1;
|
|
|
|
if ( mbFadeOut )
|
|
|
|
nButtonSize += SPLITWIN_SPLITSIZEFADE+1;
|
|
|
|
if ( mbAutoHide )
|
|
|
|
nButtonSize += SPLITWIN_SPLITSIZEAUTOHIDE+1;
|
|
|
|
long nCenterEx = 0;
|
|
|
|
if ( mbHorz )
|
|
|
|
nCenterEx += ((mnDX-mnLeftBorder-mnRightBorder)-nButtonSize)/2;
|
|
|
|
else
|
|
|
|
nCenterEx += ((mnDY-mnTopBorder-mnBottomBorder)-nButtonSize)/2;
|
|
|
|
if ( nCenterEx > 0 )
|
|
|
|
nEx += nCenterEx;
|
|
|
|
|
2012-02-18 14:18:19 +01:00
|
|
|
switch ( meAlign )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-02-18 14:18:19 +01:00
|
|
|
case WINDOWALIGN_TOP:
|
2000-09-18 16:07:07 +00:00
|
|
|
rRect.Left() = mnLeftBorder+nEx;
|
|
|
|
rRect.Top() = mnDY-mnBottomBorder-nSplitSize;
|
|
|
|
rRect.Right() = rRect.Left()+SPLITWIN_SPLITSIZEAUTOHIDE;
|
|
|
|
rRect.Bottom() = mnDY-mnBottomBorder-1;
|
|
|
|
if ( bTest )
|
|
|
|
{
|
|
|
|
rRect.Top() -= mnTopBorder;
|
|
|
|
rRect.Bottom() += mnBottomBorder;
|
|
|
|
}
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_BOTTOM:
|
2000-09-18 16:07:07 +00:00
|
|
|
rRect.Left() = mnLeftBorder+nEx;
|
|
|
|
rRect.Top() = mnTopBorder;
|
|
|
|
rRect.Right() = rRect.Left()+SPLITWIN_SPLITSIZEAUTOHIDE;
|
|
|
|
rRect.Bottom() = mnTopBorder+nSplitSize-1;
|
|
|
|
if ( bTest )
|
|
|
|
{
|
|
|
|
rRect.Top() -= mnTopBorder;
|
|
|
|
rRect.Bottom() += mnBottomBorder;
|
|
|
|
}
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_LEFT:
|
2000-09-18 16:07:07 +00:00
|
|
|
rRect.Left() = mnDX-mnRightBorder-nSplitSize;
|
|
|
|
rRect.Top() = mnTopBorder+nEx;
|
|
|
|
rRect.Right() = mnDX-mnRightBorder-1;
|
|
|
|
rRect.Bottom() = rRect.Top()+SPLITWIN_SPLITSIZEAUTOHIDE;
|
|
|
|
if ( bTest )
|
|
|
|
{
|
|
|
|
rRect.Left() -= mnLeftBorder;
|
|
|
|
rRect.Right() += mnRightBorder;
|
|
|
|
}
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case WINDOWALIGN_RIGHT:
|
2000-09-18 16:07:07 +00:00
|
|
|
rRect.Left() = mnLeftBorder;
|
|
|
|
rRect.Top() = mnTopBorder+nEx;
|
|
|
|
rRect.Right() = mnLeftBorder+nSplitSize-1;
|
|
|
|
rRect.Bottom() = rRect.Top()+SPLITWIN_SPLITSIZEAUTOHIDE;
|
|
|
|
if ( bTest )
|
|
|
|
{
|
|
|
|
rRect.Left() -= mnLeftBorder;
|
|
|
|
rRect.Right() += mnRightBorder;
|
|
|
|
}
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::ImplGetAutoHideRect( Rectangle& rRect, sal_Bool bTest ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Rectangle aRect;
|
|
|
|
|
|
|
|
if ( mbAutoHide )
|
|
|
|
{
|
|
|
|
long nEx = 0;
|
|
|
|
if ( mbFadeIn || mbFadeOut )
|
|
|
|
nEx = SPLITWIN_SPLITSIZEFADE+1;
|
|
|
|
ImplGetButtonRect( aRect, nEx, bTest && mbFadeIn );
|
|
|
|
}
|
|
|
|
|
|
|
|
rRect = aRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::ImplGetFadeInRect( Rectangle& rRect, sal_Bool bTest ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Rectangle aRect;
|
|
|
|
|
|
|
|
if ( mbFadeIn )
|
|
|
|
ImplGetButtonRect( aRect, 0, bTest );
|
|
|
|
|
|
|
|
rRect = aRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::ImplGetFadeOutRect( Rectangle& rRect, sal_Bool ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Rectangle aRect;
|
|
|
|
|
|
|
|
if ( mbFadeOut )
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplGetButtonRect( aRect, 0, sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
rRect = aRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::ImplDrawButtonRect( const Rectangle& rRect, long nSize )
|
|
|
|
{
|
|
|
|
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
|
|
|
|
|
|
|
|
if ( mbHorz )
|
|
|
|
{
|
|
|
|
long nLeft = rRect.Left();
|
|
|
|
long nRight = rRect.Right();
|
|
|
|
long nCenter = rRect.Center().Y();
|
|
|
|
long nEx1 = nLeft+((rRect.GetWidth()-nSize)/2)-2;
|
|
|
|
long nEx2 = nEx1+nSize+3;
|
|
|
|
SetLineColor( rStyleSettings.GetLightColor() );
|
|
|
|
DrawLine( Point( rRect.Left(), rRect.Top() ), Point( rRect.Left(), rRect.Bottom() ) );
|
|
|
|
DrawLine( Point( rRect.Left(), rRect.Top() ), Point( rRect.Right(), rRect.Top() ) );
|
|
|
|
SetLineColor( rStyleSettings.GetShadowColor() );
|
|
|
|
DrawLine( Point( rRect.Right(), rRect.Top() ), Point( rRect.Right(), rRect.Bottom() ) );
|
|
|
|
DrawLine( Point( rRect.Left(), rRect.Bottom() ), Point( rRect.Right(), rRect.Bottom() ) );
|
|
|
|
long i = nLeft+2;
|
|
|
|
while ( i < nRight-3 )
|
|
|
|
{
|
|
|
|
if ( (i < nEx1) || (i > nEx2 ) )
|
|
|
|
{
|
|
|
|
DrawPixel( Point( i, nCenter-2 ), rStyleSettings.GetLightColor() );
|
|
|
|
DrawPixel( Point( i+1, nCenter-2+1 ), rStyleSettings.GetShadowColor() );
|
|
|
|
}
|
|
|
|
i++;
|
2009-04-01 11:54:14 +00:00
|
|
|
if ( (i < nEx1) || ((i > nEx2 ) && (i < nRight-3)) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
DrawPixel( Point( i, nCenter+2 ), rStyleSettings.GetLightColor() );
|
|
|
|
DrawPixel( Point( i+1, nCenter+2+1 ), rStyleSettings.GetShadowColor() );
|
|
|
|
}
|
|
|
|
i += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
long nTop = rRect.Top();
|
|
|
|
long nBottom = rRect.Bottom();
|
|
|
|
long nCenter = rRect.Center().X();
|
|
|
|
long nEx1 = nTop+((rRect.GetHeight()-nSize)/2)-2;
|
|
|
|
long nEx2 = nEx1+nSize+3;
|
|
|
|
SetLineColor( rStyleSettings.GetLightColor() );
|
|
|
|
DrawLine( Point( rRect.Left(), rRect.Top() ), Point( rRect.Right(), rRect.Top() ) );
|
|
|
|
DrawLine( Point( rRect.Left(), rRect.Top() ), Point( rRect.Left(), rRect.Bottom() ) );
|
|
|
|
SetLineColor( rStyleSettings.GetShadowColor() );
|
|
|
|
DrawLine( Point( rRect.Right(), rRect.Top() ), Point( rRect.Right(), rRect.Bottom() ) );
|
|
|
|
DrawLine( Point( rRect.Left(), rRect.Bottom() ), Point( rRect.Right(), rRect.Bottom() ) );
|
|
|
|
long i = nTop+2;
|
|
|
|
while ( i < nBottom-3 )
|
|
|
|
{
|
|
|
|
if ( (i < nEx1) || (i > nEx2 ) )
|
|
|
|
{
|
|
|
|
DrawPixel( Point( nCenter-2, i ), rStyleSettings.GetLightColor() );
|
|
|
|
DrawPixel( Point( nCenter-2+1, i+1 ), rStyleSettings.GetShadowColor() );
|
|
|
|
}
|
|
|
|
i++;
|
2009-04-01 11:54:14 +00:00
|
|
|
if ( (i < nEx1) || ((i > nEx2 ) && (i < nBottom-3)) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
DrawPixel( Point( nCenter+2, i ), rStyleSettings.GetLightColor() );
|
|
|
|
DrawPixel( Point( nCenter+2+1, i+1 ), rStyleSettings.GetShadowColor() );
|
|
|
|
}
|
|
|
|
i += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::ImplDrawAutoHide( sal_Bool bInPaint )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( mbAutoHide )
|
|
|
|
{
|
|
|
|
Rectangle aTempRect;
|
|
|
|
ImplGetAutoHideRect( aTempRect );
|
|
|
|
|
|
|
|
if ( !bInPaint )
|
|
|
|
Erase( aTempRect );
|
|
|
|
|
|
|
|
// ImageListe laden, wenn noch nicht vorhanden
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
ImageList* pImageList;
|
|
|
|
if ( mbHorz )
|
|
|
|
{
|
|
|
|
if ( !pSVData->maCtrlData.mpSplitHPinImgList )
|
|
|
|
{
|
2005-09-28 13:53:30 +00:00
|
|
|
ResMgr* pResMgr = ImplGetResMgr();
|
|
|
|
if( pResMgr )
|
2007-06-06 13:22:03 +00:00
|
|
|
{
|
|
|
|
Color aNonAlphaMask( 0x00, 0x00, 0xFF );
|
|
|
|
pSVData->maCtrlData.mpSplitHPinImgList = new ImageList(4);
|
|
|
|
pSVData->maCtrlData.mpSplitHPinImgList->InsertFromHorizontalBitmap
|
|
|
|
( ResId( SV_RESID_BITMAP_SPLITHPIN, *pResMgr ), 4, &aNonAlphaMask );
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
pImageList = pSVData->maCtrlData.mpSplitHPinImgList;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( !pSVData->maCtrlData.mpSplitVPinImgList )
|
|
|
|
{
|
2005-09-28 13:53:30 +00:00
|
|
|
ResMgr* pResMgr = ImplGetResMgr();
|
2007-06-06 13:22:03 +00:00
|
|
|
pSVData->maCtrlData.mpSplitVPinImgList = new ImageList(4);
|
2005-09-28 13:53:30 +00:00
|
|
|
if( pResMgr )
|
2007-06-06 13:22:03 +00:00
|
|
|
{
|
|
|
|
Color aNonAlphaMask( 0x00, 0x00, 0xFF );
|
|
|
|
pSVData->maCtrlData.mpSplitVPinImgList->InsertFromHorizontalBitmap
|
|
|
|
( ResId( SV_RESID_BITMAP_SPLITVPIN, *pResMgr ), 4, &aNonAlphaMask );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
pImageList = pSVData->maCtrlData.mpSplitVPinImgList;
|
2007-06-06 13:22:03 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Image ermitteln und zurueckgeben
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nId;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( mbAutoHidePressed )
|
|
|
|
{
|
|
|
|
if ( mbAutoHideIn )
|
|
|
|
nId = 3;
|
|
|
|
else
|
|
|
|
nId = 4;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( mbAutoHideIn )
|
|
|
|
nId = 1;
|
|
|
|
else
|
|
|
|
nId = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
Image aImage = pImageList->GetImage( nId );
|
|
|
|
Size aImageSize = aImage.GetSizePixel();
|
|
|
|
Point aPos( aTempRect.Left()+((aTempRect.GetWidth()-aImageSize.Width())/2),
|
|
|
|
aTempRect.Top()+((aTempRect.GetHeight()-aImageSize.Height())/2) );
|
|
|
|
long nSize;
|
|
|
|
if ( mbHorz )
|
|
|
|
nSize = aImageSize.Width();
|
|
|
|
else
|
|
|
|
nSize = aImageSize.Height();
|
|
|
|
ImplDrawButtonRect( aTempRect, nSize );
|
|
|
|
DrawImage( aPos, aImage );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::ImplDrawFadeArrow( const Point& rPt, sal_Bool bHorz, sal_Bool bLeft )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-09-09 15:34:16 +00:00
|
|
|
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
|
|
|
|
|
|
|
|
int x( rPt.X() );
|
|
|
|
int y( rPt.Y() );
|
|
|
|
|
|
|
|
Color aCol;
|
|
|
|
if( !bHorz )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-09-09 15:34:16 +00:00
|
|
|
int dx = 1;
|
|
|
|
if( bLeft )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-09-09 15:34:16 +00:00
|
|
|
x ++;
|
|
|
|
dx = -1;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2004-09-09 15:34:16 +00:00
|
|
|
|
|
|
|
x++; y++;
|
|
|
|
aCol = Color( COL_WHITE );
|
|
|
|
DrawPixel( Point(x, y), aCol );
|
|
|
|
DrawPixel( Point(x, y+1), aCol );
|
|
|
|
DrawPixel( Point(x, y+2), aCol );
|
|
|
|
DrawPixel( Point(x+dx, y+1), aCol );
|
|
|
|
|
|
|
|
x--; y--;
|
|
|
|
aCol = rStyleSettings.GetDarkShadowColor();
|
|
|
|
DrawPixel( Point(x, y), rStyleSettings.GetDarkShadowColor() );
|
|
|
|
DrawPixel( Point(x, y+1), rStyleSettings.GetDarkShadowColor() );
|
|
|
|
DrawPixel( Point(x, y+2), rStyleSettings.GetDarkShadowColor() );
|
|
|
|
DrawPixel( Point(x+dx, y+1), rStyleSettings.GetDarkShadowColor() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-09-09 15:34:16 +00:00
|
|
|
int dy = 1;
|
|
|
|
if( bLeft )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-09-09 15:34:16 +00:00
|
|
|
y ++;
|
|
|
|
dy = -1;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2004-09-09 15:34:16 +00:00
|
|
|
x++; y++;
|
|
|
|
aCol = Color( COL_WHITE );
|
|
|
|
DrawPixel( Point(x, y), aCol );
|
|
|
|
DrawPixel( Point(x+1, y), aCol );
|
|
|
|
DrawPixel( Point(x+2, y), aCol );
|
|
|
|
DrawPixel( Point(x+1, y+dy), aCol );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-09-09 15:34:16 +00:00
|
|
|
x--; y--;
|
|
|
|
aCol = rStyleSettings.GetDarkShadowColor();
|
|
|
|
DrawPixel( Point(x, y), aCol );
|
|
|
|
DrawPixel( Point(x+1, y), aCol );
|
|
|
|
DrawPixel( Point(x+2, y), aCol );
|
|
|
|
DrawPixel( Point(x+1, y+dy), aCol );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::ImplDrawGrip( const Rectangle& rRect, sal_Bool bHorz, sal_Bool bLeft )
|
2004-09-09 15:34:16 +00:00
|
|
|
{
|
|
|
|
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
|
|
|
|
|
|
|
|
if( rRect.IsInside( GetPointerPosPixel() ) )
|
|
|
|
{
|
|
|
|
DrawWallpaper( rRect, Wallpaper( Color( COL_WHITE ) ) );
|
2010-09-29 15:46:40 +08:00
|
|
|
DrawSelectionBackground( rRect, 2, sal_False, sal_False, sal_False );
|
2004-09-09 15:34:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( bHorz )
|
|
|
|
{
|
|
|
|
int width = (int) (0.5 * rRect.getWidth() + 0.5);
|
2012-10-28 23:23:53 +01:00
|
|
|
int i = rRect.Left() + (rRect.getWidth() - width) / 2;
|
2004-09-09 15:34:16 +00:00
|
|
|
width += i;
|
2012-10-28 23:23:53 +01:00
|
|
|
const int y = rRect.Top() + 1;
|
2004-09-09 15:34:16 +00:00
|
|
|
ImplDrawFadeArrow( Point( i-8, y), bHorz, bLeft );
|
|
|
|
while( i <= width )
|
|
|
|
{
|
|
|
|
|
|
|
|
DrawPixel( Point(i, y), rStyleSettings.GetDarkShadowColor() );
|
|
|
|
DrawPixel( Point(i+1, y), rStyleSettings.GetShadowColor() );
|
|
|
|
|
|
|
|
DrawPixel( Point(i, y+1), rStyleSettings.GetShadowColor() );
|
|
|
|
DrawPixel( Point(i+1, y+1), rStyleSettings.GetFaceColor() );
|
|
|
|
DrawPixel( Point(i+2, y+1), Color(COL_WHITE) );
|
|
|
|
|
|
|
|
DrawPixel( Point(i+1, y+2), Color(COL_WHITE) );
|
|
|
|
DrawPixel( Point(i+2, y+2), Color(COL_WHITE) );
|
|
|
|
i+=4;
|
|
|
|
}
|
|
|
|
ImplDrawFadeArrow( Point( i+3, y), bHorz, bLeft );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int height = (int) (0.5 * rRect.getHeight() + 0.5);
|
2012-10-28 23:23:53 +01:00
|
|
|
int i = rRect.Top() + (rRect.getHeight() - height) / 2;
|
2004-09-09 15:34:16 +00:00
|
|
|
height += i;
|
2012-10-28 23:23:53 +01:00
|
|
|
const int x = rRect.Left() + 1;
|
2004-09-09 15:34:16 +00:00
|
|
|
ImplDrawFadeArrow( Point( x, i-8), bHorz, bLeft );
|
|
|
|
while( i <= height )
|
|
|
|
{
|
|
|
|
|
|
|
|
DrawPixel( Point(x, i), rStyleSettings.GetDarkShadowColor() );
|
|
|
|
DrawPixel( Point(x+1, i), rStyleSettings.GetShadowColor() );
|
|
|
|
|
|
|
|
DrawPixel( Point(x, i+1), rStyleSettings.GetShadowColor() );
|
|
|
|
DrawPixel( Point(x+1, i+1), rStyleSettings.GetFaceColor() );
|
|
|
|
DrawPixel( Point(x+2, i+1), Color(COL_WHITE) );
|
|
|
|
|
|
|
|
DrawPixel( Point(x+1, i+2), Color(COL_WHITE) );
|
|
|
|
DrawPixel( Point(x+2, i+2), Color(COL_WHITE) );
|
|
|
|
i+=4;
|
|
|
|
}
|
|
|
|
ImplDrawFadeArrow( Point( x, i+3), bHorz, bLeft );
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::ImplDrawFadeIn( sal_Bool bInPaint )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( mbFadeIn )
|
|
|
|
{
|
|
|
|
Rectangle aTempRect;
|
|
|
|
ImplGetFadeInRect( aTempRect );
|
|
|
|
|
2012-02-18 14:18:19 +01:00
|
|
|
sal_Bool bLeft = sal_True;
|
|
|
|
switch ( meAlign )
|
|
|
|
{
|
|
|
|
case WINDOWALIGN_TOP:
|
|
|
|
case WINDOWALIGN_LEFT:
|
|
|
|
bLeft = sal_False;
|
|
|
|
break;
|
|
|
|
case WINDOWALIGN_BOTTOM:
|
|
|
|
case WINDOWALIGN_RIGHT:
|
|
|
|
default:
|
|
|
|
bLeft = sal_True;
|
|
|
|
break;
|
|
|
|
}
|
2004-09-08 14:09:13 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !bInPaint )
|
|
|
|
Erase( aTempRect );
|
|
|
|
|
2004-09-09 15:34:16 +00:00
|
|
|
ImplDrawGrip( aTempRect, (meAlign == WINDOWALIGN_TOP) || (meAlign == WINDOWALIGN_BOTTOM), bLeft );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::ImplDrawFadeOut( sal_Bool bInPaint )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( mbFadeOut )
|
|
|
|
{
|
|
|
|
Rectangle aTempRect;
|
|
|
|
ImplGetFadeOutRect( aTempRect );
|
|
|
|
|
2012-02-18 14:18:19 +01:00
|
|
|
sal_Bool bLeft = sal_True;
|
|
|
|
switch ( meAlign )
|
|
|
|
{
|
|
|
|
case WINDOWALIGN_BOTTOM:
|
|
|
|
case WINDOWALIGN_RIGHT:
|
|
|
|
bLeft = sal_False;
|
|
|
|
break;
|
|
|
|
case WINDOWALIGN_TOP:
|
|
|
|
case WINDOWALIGN_LEFT:
|
|
|
|
default:
|
|
|
|
bLeft = sal_True;
|
|
|
|
break;
|
|
|
|
}
|
2004-09-08 14:09:13 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !bInPaint )
|
|
|
|
Erase( aTempRect );
|
|
|
|
|
2004-09-09 15:34:16 +00:00
|
|
|
ImplDrawGrip( aTempRect, (meAlign == WINDOWALIGN_TOP) || (meAlign == WINDOWALIGN_BOTTOM), bLeft );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-31 12:25:46 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt )
|
|
|
|
{
|
|
|
|
Point aMousePosPixel = rMEvt.GetPosPixel();
|
|
|
|
mnSplitTest = ImplTestSplit( this, aMousePosPixel, mnMouseOff, &mpSplitSet, mnSplitPos );
|
|
|
|
|
|
|
|
if ( mnSplitTest && !(mnSplitTest & SPLIT_NOSPLIT) )
|
|
|
|
{
|
|
|
|
ImplSplitItem* pSplitItem;
|
|
|
|
long nCurMaxSize;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nTemp;
|
2013-06-21 21:40:18 +09:00
|
|
|
bool bDown;
|
|
|
|
bool bPropSmaller;
|
2005-01-31 12:25:46 +00:00
|
|
|
|
|
|
|
mnMouseModifier = rMEvt.GetModifier();
|
|
|
|
if ( !(mnMouseModifier & KEY_SHIFT) || (mnSplitPos+1 >= mpSplitSet->mnItems) )
|
2013-06-21 21:40:18 +09:00
|
|
|
bPropSmaller = false;
|
2005-01-31 12:25:46 +00:00
|
|
|
else
|
2013-06-21 21:40:18 +09:00
|
|
|
bPropSmaller = true;
|
2005-01-31 12:25:46 +00:00
|
|
|
|
|
|
|
// Hier kann noch die maximale Groesse gesetzt werden
|
|
|
|
StartSplit();
|
|
|
|
|
|
|
|
if ( mnMaxSize )
|
|
|
|
nCurMaxSize = mnMaxSize;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Size aSize = GetParent()->GetOutputSizePixel();
|
|
|
|
if ( mbHorz )
|
|
|
|
nCurMaxSize = aSize.Height();
|
|
|
|
else
|
|
|
|
nCurMaxSize = aSize.Width();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( mpSplitSet->mpItems )
|
|
|
|
{
|
2013-06-21 21:40:18 +09:00
|
|
|
bDown = true;
|
2005-01-31 12:25:46 +00:00
|
|
|
if ( (mpSplitSet == mpMainSet) && mbBottomRight )
|
2013-06-21 21:40:18 +09:00
|
|
|
bDown = false;
|
2005-01-31 12:25:46 +00:00
|
|
|
|
|
|
|
pSplitItem = &(mpSplitSet->mpItems[mnSplitPos]);
|
|
|
|
maDragRect.Left() = pSplitItem->mnLeft;
|
|
|
|
maDragRect.Top() = pSplitItem->mnTop;
|
|
|
|
maDragRect.Right() = pSplitItem->mnLeft+pSplitItem->mnWidth-1;
|
|
|
|
maDragRect.Bottom() = pSplitItem->mnTop+pSplitItem->mnHeight-1;
|
|
|
|
|
|
|
|
if ( mnSplitTest & SPLIT_HORZ )
|
|
|
|
{
|
|
|
|
if ( bDown )
|
|
|
|
maDragRect.Right() += mpSplitSet->mnSplitSize;
|
|
|
|
else
|
|
|
|
maDragRect.Left() -= mpSplitSet->mnSplitSize;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( bDown )
|
|
|
|
maDragRect.Bottom() += mpSplitSet->mnSplitSize;
|
|
|
|
else
|
|
|
|
maDragRect.Top() -= mpSplitSet->mnSplitSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( mnSplitPos )
|
|
|
|
{
|
|
|
|
nTemp = mnSplitPos;
|
|
|
|
while ( nTemp )
|
|
|
|
{
|
|
|
|
pSplitItem = &(mpSplitSet->mpItems[nTemp-1]);
|
|
|
|
if ( pSplitItem->mbFixed )
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( mnSplitTest & SPLIT_HORZ )
|
|
|
|
{
|
|
|
|
if ( bDown )
|
|
|
|
maDragRect.Left() -= pSplitItem->mnPixSize;
|
|
|
|
else
|
|
|
|
maDragRect.Right() += pSplitItem->mnPixSize;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( bDown )
|
|
|
|
maDragRect.Top() -= pSplitItem->mnPixSize;
|
|
|
|
else
|
|
|
|
maDragRect.Bottom() += pSplitItem->mnPixSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nTemp--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( (mpSplitSet == mpMainSet) && (mnWinStyle & WB_SIZEABLE) && !bPropSmaller )
|
|
|
|
{
|
|
|
|
if ( bDown )
|
|
|
|
{
|
|
|
|
if ( mbHorz )
|
|
|
|
maDragRect.Bottom() += nCurMaxSize-mnDY-mnTopBorder;
|
|
|
|
else
|
|
|
|
maDragRect.Right() += nCurMaxSize-mnDX-mnLeftBorder;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( mbHorz )
|
|
|
|
maDragRect.Top() -= nCurMaxSize-mnDY-mnBottomBorder;
|
|
|
|
else
|
|
|
|
maDragRect.Left() -= nCurMaxSize-mnDX-mnRightBorder;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nTemp = mnSplitPos+1;
|
|
|
|
while ( nTemp < mpSplitSet->mnItems )
|
|
|
|
{
|
|
|
|
pSplitItem = &(mpSplitSet->mpItems[nTemp]);
|
|
|
|
if ( pSplitItem->mbFixed )
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( mnSplitTest & SPLIT_HORZ )
|
|
|
|
{
|
|
|
|
if ( bDown )
|
|
|
|
maDragRect.Right() += pSplitItem->mnPixSize;
|
|
|
|
else
|
|
|
|
maDragRect.Left() -= pSplitItem->mnPixSize;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( bDown )
|
|
|
|
maDragRect.Bottom() += pSplitItem->mnPixSize;
|
|
|
|
else
|
|
|
|
maDragRect.Top() -= pSplitItem->mnPixSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nTemp++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
maDragRect.Left() = mnLeftBorder;
|
|
|
|
maDragRect.Top() = mnTopBorder;
|
|
|
|
maDragRect.Right() = mnDX-mnRightBorder-1;
|
|
|
|
maDragRect.Bottom() = mnDY-mnBottomBorder-1;
|
|
|
|
if ( mbHorz )
|
|
|
|
{
|
|
|
|
if ( mbBottomRight )
|
|
|
|
maDragRect.Top() -= nCurMaxSize-mnDY-mnBottomBorder;
|
|
|
|
else
|
|
|
|
maDragRect.Bottom() += nCurMaxSize-mnDY-mnTopBorder;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( mbBottomRight )
|
|
|
|
maDragRect.Left() -= nCurMaxSize-mnDX-mnRightBorder;
|
|
|
|
else
|
|
|
|
maDragRect.Right() += nCurMaxSize-mnDX-mnLeftBorder;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StartTracking();
|
|
|
|
|
|
|
|
mbDragFull = (GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SPLIT) != 0;
|
|
|
|
|
|
|
|
ImplSplitMousePos( aMousePosPixel );
|
|
|
|
|
|
|
|
if ( !mbDragFull )
|
|
|
|
ImplDrawSplitTracking( this, aMousePosPixel );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ImplSplitItem* pItems = mpSplitSet->mpItems;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nItems = mpSplitSet->mnItems;
|
2005-01-31 12:25:46 +00:00
|
|
|
mpLastSizes = new long[nItems*2];
|
2010-09-29 15:46:40 +08:00
|
|
|
for ( sal_uInt16 i = 0; i < nItems; i++ )
|
2005-01-31 12:25:46 +00:00
|
|
|
{
|
|
|
|
mpLastSizes[i*2] = pItems[i].mnSize;
|
|
|
|
mpLastSizes[i*2+1] = pItems[i].mnPixSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mnMStartPos = mnMSplitPos;
|
|
|
|
|
|
|
|
PointerStyle eStyle = POINTER_ARROW;
|
|
|
|
if ( mnSplitTest & SPLIT_HORZ )
|
|
|
|
eStyle = POINTER_HSPLIT;
|
|
|
|
else if ( mnSplitTest & SPLIT_VERT )
|
|
|
|
eStyle = POINTER_VSPLIT;
|
|
|
|
|
|
|
|
Pointer aPtr( eStyle );
|
|
|
|
SetPointer( aPtr );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::StartSplit()
|
|
|
|
{
|
|
|
|
maStartSplitHdl.Call( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::Split()
|
|
|
|
{
|
|
|
|
maSplitHdl.Call( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::SplitResize()
|
|
|
|
{
|
|
|
|
maSplitResizeHdl.Call( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::AutoHide()
|
|
|
|
{
|
|
|
|
maAutoHideHdl.Call( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::FadeIn()
|
|
|
|
{
|
|
|
|
maFadeInHdl.Call( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::FadeOut()
|
|
|
|
{
|
|
|
|
maFadeOutHdl.Call( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::MouseButtonDown( const MouseEvent& rMEvt )
|
|
|
|
{
|
|
|
|
if ( !rMEvt.IsLeft() || rMEvt.IsMod2() )
|
|
|
|
{
|
|
|
|
DockingWindow::MouseButtonDown( rMEvt );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Point aMousePosPixel = rMEvt.GetPosPixel();
|
|
|
|
Rectangle aTestRect;
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
mbFadeNoButtonMode = sal_False;
|
|
|
|
ImplGetAutoHideRect( aTestRect, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( aTestRect.IsInside( aMousePosPixel ) )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbAutoHideDown = sal_True;
|
|
|
|
mbAutoHidePressed = sal_True;
|
|
|
|
ImplDrawAutoHide( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplGetFadeOutRect( aTestRect, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( aTestRect.IsInside( aMousePosPixel ) )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbFadeOutDown = sal_True;
|
|
|
|
mbFadeOutPressed = sal_True;
|
|
|
|
ImplDrawFadeOut( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplGetFadeInRect( aTestRect, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( aTestRect.IsInside( aMousePosPixel ) )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbFadeInDown = sal_True;
|
|
|
|
mbFadeInPressed = sal_True;
|
|
|
|
ImplDrawFadeIn( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else if ( !aTestRect.IsEmpty() && !(mnWinStyle & WB_SIZEABLE) )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbFadeNoButtonMode = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
FadeIn();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( mbAutoHideDown || mbFadeInDown || mbFadeOutDown )
|
|
|
|
StartTracking();
|
|
|
|
else
|
2005-01-31 12:25:46 +00:00
|
|
|
ImplStartSplit( rMEvt );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::MouseMove( const MouseEvent& rMEvt )
|
|
|
|
{
|
|
|
|
if ( !IsTracking() )
|
|
|
|
{
|
|
|
|
Point aPos = rMEvt.GetPosPixel();
|
|
|
|
long nTemp;
|
|
|
|
ImplSplitSet* pTempSplitSet;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nTempSplitPos;
|
|
|
|
sal_uInt16 nSplitTest = ImplTestSplit( this, aPos, nTemp, &pTempSplitSet, nTempSplitPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
PointerStyle eStyle = POINTER_ARROW;
|
|
|
|
Rectangle aAutoHideRect;
|
|
|
|
Rectangle aFadeInRect;
|
|
|
|
Rectangle aFadeOutRect;
|
|
|
|
|
|
|
|
ImplGetAutoHideRect( aAutoHideRect );
|
|
|
|
ImplGetFadeInRect( aFadeInRect );
|
|
|
|
ImplGetFadeOutRect( aFadeOutRect );
|
|
|
|
if ( !aAutoHideRect.IsInside( aPos ) &&
|
|
|
|
!aFadeInRect.IsInside( aPos ) &&
|
|
|
|
!aFadeOutRect.IsInside( aPos ) )
|
|
|
|
{
|
|
|
|
if ( nSplitTest && !(nSplitTest & SPLIT_NOSPLIT) )
|
|
|
|
{
|
|
|
|
if ( nSplitTest & SPLIT_HORZ )
|
|
|
|
eStyle = POINTER_HSPLIT;
|
|
|
|
else if ( nSplitTest & SPLIT_VERT )
|
|
|
|
eStyle = POINTER_VSPLIT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Pointer aPtr( eStyle );
|
|
|
|
SetPointer( aPtr );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::Tracking( const TrackingEvent& rTEvt )
|
|
|
|
{
|
|
|
|
Point aMousePosPixel = rTEvt.GetMouseEvent().GetPosPixel();
|
|
|
|
|
|
|
|
if ( mbAutoHideDown )
|
|
|
|
{
|
|
|
|
if ( rTEvt.IsTrackingEnded() )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbAutoHideDown = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( mbAutoHidePressed )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbAutoHidePressed = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( !rTEvt.IsTrackingCanceled() )
|
|
|
|
{
|
|
|
|
mbAutoHideIn = !mbAutoHideIn;
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplDrawAutoHide( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
AutoHide();
|
|
|
|
}
|
|
|
|
else
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplDrawAutoHide( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Rectangle aTestRect;
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplGetAutoHideRect( aTestRect, sal_True );
|
|
|
|
sal_Bool bNewPressed = aTestRect.IsInside( aMousePosPixel );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( bNewPressed != mbAutoHidePressed )
|
|
|
|
{
|
|
|
|
mbAutoHidePressed = bNewPressed;
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplDrawAutoHide( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( mbFadeInDown )
|
|
|
|
{
|
|
|
|
if ( rTEvt.IsTrackingEnded() )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbFadeInDown = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( mbFadeInPressed )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbFadeInPressed = sal_False;
|
|
|
|
ImplDrawFadeIn( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( !rTEvt.IsTrackingCanceled() )
|
|
|
|
FadeIn();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Rectangle aTestRect;
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplGetFadeInRect( aTestRect, sal_True );
|
|
|
|
sal_Bool bNewPressed = aTestRect.IsInside( aMousePosPixel );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( bNewPressed != mbFadeInPressed )
|
|
|
|
{
|
|
|
|
mbFadeInPressed = bNewPressed;
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplDrawFadeIn( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( mbFadeOutDown )
|
|
|
|
{
|
|
|
|
if ( rTEvt.IsTrackingEnded() )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbFadeOutDown = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( mbFadeOutPressed )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbFadeOutPressed = sal_False;
|
|
|
|
ImplDrawFadeOut( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( !rTEvt.IsTrackingCanceled() )
|
|
|
|
FadeOut();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Rectangle aTestRect;
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplGetFadeOutRect( aTestRect, sal_True );
|
|
|
|
sal_Bool bNewPressed = aTestRect.IsInside( aMousePosPixel );
|
|
|
|
if ( bNewPressed == sal_False )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
mbFadeOutPressed = bNewPressed;
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplDrawFadeOut( sal_False );
|
2005-01-31 12:25:46 +00:00
|
|
|
|
|
|
|
// We need a mouseevent with a position inside the button for the
|
|
|
|
// ImplStartSplit function!
|
|
|
|
MouseEvent aOrgMEvt = rTEvt.GetMouseEvent();
|
|
|
|
MouseEvent aNewMEvt = MouseEvent( aTestRect.Center(), aOrgMEvt.GetClicks(),
|
|
|
|
aOrgMEvt.GetMode(), aOrgMEvt.GetButtons(),
|
|
|
|
aOrgMEvt.GetModifier() );
|
|
|
|
|
|
|
|
ImplStartSplit( aNewMEvt );
|
2010-09-29 15:46:40 +08:00
|
|
|
mbFadeOutDown = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ImplSplitMousePos( aMousePosPixel );
|
2013-06-21 21:40:18 +09:00
|
|
|
bool bSplit = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( mbDragFull )
|
|
|
|
{
|
|
|
|
if ( rTEvt.IsTrackingEnded() )
|
|
|
|
{
|
|
|
|
if ( rTEvt.IsTrackingCanceled() )
|
|
|
|
{
|
|
|
|
ImplSplitItem* pItems = mpSplitSet->mpItems;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nItems = mpSplitSet->mnItems;
|
|
|
|
for ( sal_uInt16 i = 0; i < nItems; i++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pItems[i].mnSize = mpLastSizes[i*2];
|
|
|
|
pItems[i].mnPixSize = mpLastSizes[i*2+1];
|
|
|
|
}
|
|
|
|
ImplUpdate();
|
|
|
|
Split();
|
|
|
|
}
|
2013-06-21 21:40:18 +09:00
|
|
|
bSplit = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( rTEvt.IsTrackingEnded() )
|
|
|
|
{
|
|
|
|
HideTracking();
|
|
|
|
bSplit = !rTEvt.IsTrackingCanceled();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ImplDrawSplitTracking( this, aMousePosPixel );
|
2013-06-21 21:40:18 +09:00
|
|
|
bSplit = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bSplit )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bPropSmaller = (mnMouseModifier & KEY_SHIFT) ? sal_True : sal_False;
|
|
|
|
sal_Bool bPropGreater = (mnMouseModifier & KEY_MOD1) ? sal_True : sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( (mnSplitTest & SPLIT_WINDOW) && !mpMainSet->mpItems )
|
|
|
|
{
|
2013-09-07 23:53:02 +05:30
|
|
|
// nDelta corresponds to the direction to which user drags the mouse.
|
|
|
|
// If nDelta > 0, means user has dragged the handle towards the right and vice-versa
|
|
|
|
long nDelta = mnMSplitPos-mnMStartPos;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( (mpSplitSet == mpMainSet) && mbBottomRight )
|
|
|
|
nDelta *= -1;
|
|
|
|
ImplSetWindowSize( nDelta );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-09-07 23:53:02 +05:30
|
|
|
long nNewSize( 0 );
|
|
|
|
|
|
|
|
// where is the sidebar is attached?
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( (mpSplitSet == mpMainSet) && mbBottomRight )
|
2013-09-07 23:53:02 +05:30
|
|
|
nNewSize = mnMaxSize - mnMStartPos; // right hand side of the screen
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2013-09-07 23:53:02 +05:30
|
|
|
nNewSize = mnMStartPos; // left hand side of the screen
|
|
|
|
|
|
|
|
// do not make the sidebar wider than mnMaxSize
|
|
|
|
nNewSize = std::min(nNewSize, mpSplitSet->mpItems[mnSplitPos].mnMaxSize);
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SplitItem( mpSplitSet->mpItems[mnSplitPos].mnId, nNewSize,
|
|
|
|
bPropSmaller, bPropGreater );
|
|
|
|
}
|
|
|
|
|
|
|
|
Split();
|
|
|
|
|
|
|
|
if ( mbDragFull )
|
|
|
|
{
|
|
|
|
Update();
|
|
|
|
mnMStartPos = mnMSplitPos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( rTEvt.IsTrackingEnded() )
|
|
|
|
{
|
2013-06-27 11:11:51 +01:00
|
|
|
delete [] mpLastSizes;
|
2000-09-18 16:07:07 +00:00
|
|
|
mpLastSizes = NULL;
|
|
|
|
mpSplitSet = NULL;
|
|
|
|
mnMouseOff = 0;
|
|
|
|
mnMStartPos = 0;
|
|
|
|
mnMSplitPos = 0;
|
|
|
|
mnMouseModifier = 0;
|
|
|
|
mnSplitTest = 0;
|
|
|
|
mnSplitPos = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2004-09-09 15:34:16 +00:00
|
|
|
long SplitWindow::PreNotify( NotifyEvent& rNEvt )
|
|
|
|
{
|
|
|
|
const MouseEvent* pMouseEvt = NULL;
|
|
|
|
|
2006-06-19 18:40:29 +00:00
|
|
|
if( (rNEvt.GetType() == EVENT_MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != NULL )
|
2004-09-09 15:34:16 +00:00
|
|
|
{
|
|
|
|
if( !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() )
|
|
|
|
{
|
|
|
|
// trigger redraw if mouse over state has changed
|
|
|
|
Rectangle aFadeInRect;
|
|
|
|
Rectangle aFadeOutRect;
|
|
|
|
ImplGetFadeInRect( aFadeInRect );
|
|
|
|
ImplGetFadeOutRect( aFadeOutRect );
|
|
|
|
|
|
|
|
if ( aFadeInRect.IsInside( GetPointerPosPixel() ) != aFadeInRect.IsInside( GetLastPointerPosPixel() ) )
|
|
|
|
Invalidate( aFadeInRect );
|
|
|
|
if ( aFadeOutRect.IsInside( GetPointerPosPixel() ) != aFadeOutRect.IsInside( GetLastPointerPosPixel() ) )
|
|
|
|
Invalidate( aFadeOutRect );
|
|
|
|
|
|
|
|
if( pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow() )
|
|
|
|
{
|
|
|
|
Invalidate( aFadeInRect );
|
|
|
|
Invalidate( aFadeOutRect );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Window::PreNotify( rNEvt );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void SplitWindow::Paint( const Rectangle& )
|
|
|
|
{
|
|
|
|
if ( mnWinStyle & WB_BORDER )
|
|
|
|
ImplDrawBorder( this );
|
|
|
|
|
2005-01-31 12:25:46 +00:00
|
|
|
ImplDrawBorderLine( this );
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplDrawFadeOut( sal_True );
|
|
|
|
ImplDrawFadeIn( sal_True );
|
|
|
|
ImplDrawAutoHide( sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// FrameSet-Hintergruende zeichnen
|
|
|
|
ImplDrawBack( this, mpMainSet );
|
|
|
|
|
|
|
|
// Splitter zeichnen
|
|
|
|
if ( !(mnWinStyle & WB_NOSPLITDRAW) )
|
|
|
|
ImplDrawSplit( this, mpMainSet, mbHorz, !mbBottomRight );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::Move()
|
|
|
|
{
|
|
|
|
DockingWindow::Move();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::Resize()
|
|
|
|
{
|
|
|
|
Size aSize = GetOutputSizePixel();
|
|
|
|
mnDX = aSize.Width();
|
|
|
|
mnDY = aSize.Height();
|
|
|
|
|
|
|
|
ImplUpdate();
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::RequestHelp( const HelpEvent& rHEvt )
|
|
|
|
{
|
2002-04-24 11:12:05 +00:00
|
|
|
// no keyboard help for splitwin
|
|
|
|
if ( rHEvt.GetMode() & (HELPMODE_BALLOON | HELPMODE_QUICK) && !rHEvt.KeyboardActivated() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Point aMousePosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
|
|
|
|
Rectangle aHelpRect;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nHelpResId = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplGetAutoHideRect( aHelpRect, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( aHelpRect.IsInside( aMousePosPixel ) )
|
|
|
|
{
|
|
|
|
if ( mbAutoHideIn )
|
|
|
|
nHelpResId = SV_HELPTEXT_SPLITFIXED;
|
|
|
|
else
|
|
|
|
nHelpResId = SV_HELPTEXT_SPLITFLOATING;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplGetFadeInRect( aHelpRect, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( aHelpRect.IsInside( aMousePosPixel ) )
|
|
|
|
nHelpResId = SV_HELPTEXT_FADEIN;
|
|
|
|
else
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplGetFadeOutRect( aHelpRect, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( aHelpRect.IsInside( aMousePosPixel ) )
|
|
|
|
nHelpResId = SV_HELPTEXT_FADEOUT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rechteck ermitteln
|
|
|
|
if ( nHelpResId )
|
|
|
|
{
|
|
|
|
Point aPt = OutputToScreenPixel( aHelpRect.TopLeft() );
|
|
|
|
aHelpRect.Left() = aPt.X();
|
|
|
|
aHelpRect.Top() = aPt.Y();
|
|
|
|
aPt = OutputToScreenPixel( aHelpRect.BottomRight() );
|
|
|
|
aHelpRect.Right() = aPt.X();
|
|
|
|
aHelpRect.Bottom() = aPt.Y();
|
|
|
|
|
|
|
|
// Text ermitteln und anzeigen
|
2013-08-11 17:00:11 +01:00
|
|
|
OUString aStr;
|
2005-09-28 13:53:30 +00:00
|
|
|
ResMgr* pResMgr = ImplGetResMgr();
|
|
|
|
if( pResMgr )
|
2012-04-29 23:36:57 +01:00
|
|
|
aStr = ResId( nHelpResId, *pResMgr ).toString();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( rHEvt.GetMode() & HELPMODE_BALLOON )
|
|
|
|
Help::ShowBalloon( this, aHelpRect.Center(), aHelpRect, aStr );
|
|
|
|
else
|
|
|
|
Help::ShowQuickHelp( this, aHelpRect, aStr );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DockingWindow::RequestHelp( rHEvt );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::StateChanged( StateChangedType nType )
|
|
|
|
{
|
2012-02-18 14:18:19 +01:00
|
|
|
switch ( nType )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-02-18 14:18:19 +01:00
|
|
|
case STATE_CHANGE_INITSHOW:
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( IsUpdateMode() )
|
|
|
|
ImplCalcLayout();
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case STATE_CHANGE_UPDATEMODE:
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( IsUpdateMode() && IsReallyShown() )
|
|
|
|
ImplCalcLayout();
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
|
|
|
case STATE_CHANGE_CONTROLBACKGROUND:
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplInitSettings();
|
|
|
|
Invalidate();
|
2012-02-18 14:18:19 +01:00
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DockingWindow::StateChanged( nType );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::DataChanged( const DataChangedEvent& rDCEvt )
|
|
|
|
{
|
|
|
|
if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
|
|
|
|
(rDCEvt.GetFlags() & SETTINGS_STYLE) )
|
|
|
|
{
|
|
|
|
ImplInitSettings();
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
DockingWindow::DataChanged( rDCEvt );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::InsertItem( sal_uInt16 nId, Window* pWindow, long nSize,
|
|
|
|
sal_uInt16 nPos, sal_uInt16 nSetId,
|
2000-09-18 16:07:07 +00:00
|
|
|
SplitWindowItemBits nBits )
|
|
|
|
{
|
|
|
|
#ifdef DBG_UTIL
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nDbgDummy;
|
2000-09-18 16:07:07 +00:00
|
|
|
DBG_ASSERT( ImplFindSet( mpMainSet, nSetId ), "SplitWindow::InsertItem() - Set not exists" );
|
|
|
|
DBG_ASSERT( !ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::InsertItem() - Id already exists" );
|
|
|
|
#endif
|
|
|
|
|
2010-03-19 15:06:39 +01:00
|
|
|
// Size has to be at least 1.
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nSize < 1 )
|
|
|
|
nSize = 1;
|
|
|
|
|
|
|
|
ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
|
|
|
|
ImplSplitSet* pNewSet;
|
|
|
|
ImplSplitItem* pItem;
|
|
|
|
|
2010-03-19 15:06:39 +01:00
|
|
|
// Make room for the new item.
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nPos > pSet->mnItems )
|
|
|
|
nPos = pSet->mnItems;
|
|
|
|
ImplSplitItem* pNewItems = new ImplSplitItem[pSet->mnItems+1];
|
|
|
|
if ( nPos )
|
|
|
|
memcpy( pNewItems, pSet->mpItems, sizeof( ImplSplitItem )*nPos );
|
|
|
|
if ( nPos < pSet->mnItems )
|
|
|
|
memcpy( pNewItems+nPos+1, pSet->mpItems+nPos, sizeof( ImplSplitItem )*(pSet->mnItems-nPos) );
|
2003-03-27 16:59:30 +00:00
|
|
|
delete[] pSet->mpItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
pSet->mpItems = pNewItems;
|
|
|
|
pSet->mnItems++;
|
2013-06-21 21:40:18 +09:00
|
|
|
pSet->mbCalcPix = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-03-19 15:06:39 +01:00
|
|
|
// Create and initialize item.
|
2000-09-18 16:07:07 +00:00
|
|
|
pItem = &(pSet->mpItems[nPos]);
|
|
|
|
memset( pItem, 0, sizeof( ImplSplitItem ) );
|
|
|
|
pItem->mnSize = nSize;
|
|
|
|
pItem->mnId = nId;
|
|
|
|
pItem->mnBits = nBits;
|
2010-03-19 15:06:39 +01:00
|
|
|
pItem->mnMinSize=-1;
|
|
|
|
pItem->mnMaxSize=-1;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( pWindow )
|
|
|
|
{
|
|
|
|
pItem->mpWindow = pWindow;
|
|
|
|
pItem->mpOrgParent = pWindow->GetParent();
|
|
|
|
|
2010-03-19 15:06:39 +01:00
|
|
|
// Attach window to SplitWindow.
|
2000-09-18 16:07:07 +00:00
|
|
|
pWindow->Hide();
|
|
|
|
pWindow->SetParent( this );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pNewSet = new ImplSplitSet;
|
|
|
|
pNewSet->mpItems = NULL;
|
|
|
|
pNewSet->mpWallpaper = NULL;
|
|
|
|
pNewSet->mpBitmap = NULL;
|
|
|
|
pNewSet->mnLastSize = 0;
|
|
|
|
pNewSet->mnItems = 0;
|
|
|
|
pNewSet->mnId = nId;
|
|
|
|
pNewSet->mnSplitSize = pSet->mnSplitSize;
|
2013-06-21 21:40:18 +09:00
|
|
|
pNewSet->mbCalcPix = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pItem->mpSet = pNewSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
ImplUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::InsertItem( sal_uInt16 nId, long nSize,
|
|
|
|
sal_uInt16 nPos, sal_uInt16 nSetId,
|
2000-09-18 16:07:07 +00:00
|
|
|
SplitWindowItemBits nBits )
|
|
|
|
{
|
|
|
|
InsertItem( nId, NULL, nSize, nPos, nSetId, nBits );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::RemoveItem( sal_uInt16 nId, sal_Bool bHide )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
#ifdef DBG_UTIL
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nDbgDummy;
|
2000-09-18 16:07:07 +00:00
|
|
|
DBG_ASSERT( ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::RemoveItem() - Id not found" );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Set suchen
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSplitSet* pSet = ImplFindItem( mpMainSet, nId, nPos );
|
|
|
|
ImplSplitItem* pItem = &(pSet->mpItems[nPos]);
|
|
|
|
Window* pWindow = pItem->mpWindow;
|
|
|
|
Window* pOrgParent = pItem->mpOrgParent;
|
|
|
|
|
|
|
|
// Evt. Set loeschen
|
|
|
|
if ( !pWindow )
|
|
|
|
ImplDeleteSet( pItem->mpSet );
|
|
|
|
|
|
|
|
// Item entfernen
|
|
|
|
pSet->mnItems--;
|
2013-06-21 21:40:18 +09:00
|
|
|
pSet->mbCalcPix = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pSet->mnItems )
|
|
|
|
{
|
|
|
|
memmove( pSet->mpItems+nPos, pSet->mpItems+nPos+1,
|
|
|
|
(pSet->mnItems-nPos)*sizeof( ImplSplitItem ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
delete[] pSet->mpItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
pSet->mpItems = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ImplUpdate();
|
|
|
|
|
|
|
|
// Window erst hier loeschen, um weniger Paints zu haben
|
|
|
|
if ( pWindow )
|
|
|
|
{
|
|
|
|
// Fenster wieder herstellen
|
|
|
|
if ( bHide || (pOrgParent != this) )
|
|
|
|
{
|
|
|
|
pWindow->Hide();
|
|
|
|
pWindow->SetParent( pOrgParent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::Clear()
|
|
|
|
{
|
|
|
|
// Alle Sets loeschen
|
|
|
|
ImplDeleteSet( mpMainSet );
|
|
|
|
|
|
|
|
// Main-Set wieder anlegen
|
|
|
|
mpMainSet = new ImplSplitSet;
|
|
|
|
mpMainSet->mpItems = NULL;
|
|
|
|
mpMainSet->mpWallpaper = NULL;
|
|
|
|
mpMainSet->mpBitmap = NULL;
|
|
|
|
mpMainSet->mnLastSize = 0;
|
|
|
|
mpMainSet->mnItems = 0;
|
|
|
|
mpMainSet->mnId = 0;
|
|
|
|
mpMainSet->mnSplitSize = SPLITWIN_SPLITSIZE;
|
2013-06-21 21:40:18 +09:00
|
|
|
mpMainSet->mbCalcPix = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( mnWinStyle & WB_NOSPLITDRAW )
|
|
|
|
mpMainSet->mnSplitSize -= 2;
|
|
|
|
mpBaseSet = mpMainSet;
|
|
|
|
|
|
|
|
// Und neu invalidieren
|
|
|
|
ImplUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
|
|
|
|
sal_Bool bPropSmall, sal_Bool bPropGreat )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nItems;
|
|
|
|
sal_uInt16 nPos;
|
|
|
|
sal_uInt16 nMin;
|
|
|
|
sal_uInt16 nMax;
|
|
|
|
sal_uInt16 i;
|
|
|
|
sal_uInt16 n;
|
2000-09-18 16:07:07 +00:00
|
|
|
long nDelta;
|
|
|
|
long nTempDelta;
|
|
|
|
ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
|
|
|
|
ImplSplitItem* pItems;
|
|
|
|
|
|
|
|
if ( !pSet )
|
|
|
|
return;
|
|
|
|
|
|
|
|
nItems = pSet->mnItems;
|
|
|
|
pItems = pSet->mpItems;
|
|
|
|
|
2010-03-19 15:06:39 +01:00
|
|
|
// When there is an explicit minimum or maximum size then move nNewSize
|
|
|
|
// into that range (when it is not yet already in it.)
|
|
|
|
nNewSize = ValidateSize(nNewSize, pItems[nPos]);
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( mbCalc )
|
|
|
|
{
|
|
|
|
pItems[nPos].mnSize = nNewSize;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nDelta = nNewSize-pItems[nPos].mnPixSize;
|
|
|
|
if ( !nDelta )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Bereich berechnen, der beim Splitten betroffen sein kann
|
|
|
|
nMin = 0;
|
|
|
|
nMax = nItems;
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( pItems[i].mbFixed )
|
|
|
|
{
|
|
|
|
if ( i < nPos )
|
|
|
|
nMin = i+1;
|
|
|
|
else
|
|
|
|
nMax = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Wenn das Fenster sizeable ist, wird das TopSet anders behandelt
|
2013-06-21 21:40:18 +09:00
|
|
|
bool bSmall = true;
|
|
|
|
bool bGreat = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( (pSet == mpMainSet) && (mnWinStyle & WB_SIZEABLE) )
|
|
|
|
{
|
|
|
|
if ( nPos < pSet->mnItems-1 )
|
|
|
|
{
|
|
|
|
if ( !((bPropSmall && bPropGreat) ||
|
|
|
|
((nDelta > 0) && bPropSmall) ||
|
|
|
|
((nDelta < 0) && bPropGreat)) )
|
|
|
|
{
|
|
|
|
if ( nDelta < 0 )
|
2013-06-21 21:40:18 +09:00
|
|
|
bGreat = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2013-06-21 21:40:18 +09:00
|
|
|
bSmall = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( nDelta < 0 )
|
2013-06-21 21:40:18 +09:00
|
|
|
bGreat = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2013-06-21 21:40:18 +09:00
|
|
|
bSmall = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( nPos >= nMax )
|
|
|
|
{
|
2013-06-21 21:40:18 +09:00
|
|
|
bSmall = false;
|
|
|
|
bGreat = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else if ( nPos && (nPos >= pSet->mnItems-1) )
|
|
|
|
{
|
|
|
|
nPos--;
|
|
|
|
nDelta *= -1;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bTemp = bPropSmall;
|
2000-09-18 16:07:07 +00:00
|
|
|
bPropSmall = bPropGreat;
|
|
|
|
bPropGreat = bTemp;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Jetzt die Fenster splitten
|
|
|
|
if ( nDelta < 0 )
|
|
|
|
{
|
|
|
|
if ( bGreat )
|
|
|
|
{
|
|
|
|
if ( bPropGreat )
|
|
|
|
{
|
|
|
|
nTempDelta = nDelta;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
n = nPos+1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( nTempDelta )
|
|
|
|
{
|
|
|
|
pItems[n].mnPixSize++;
|
|
|
|
nTempDelta++;
|
|
|
|
}
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
while ( n < nMax );
|
|
|
|
}
|
|
|
|
while ( nTempDelta );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pItems[nPos+1].mnPixSize -= nDelta;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bSmall )
|
|
|
|
{
|
|
|
|
if ( bPropSmall )
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
n = nPos+1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( nDelta && pItems[n-1].mnPixSize )
|
|
|
|
{
|
|
|
|
pItems[n-1].mnPixSize--;
|
|
|
|
nDelta++;
|
|
|
|
}
|
|
|
|
|
|
|
|
n--;
|
|
|
|
}
|
|
|
|
while ( n > nMin );
|
|
|
|
}
|
|
|
|
while ( nDelta );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
n = nPos+1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( pItems[n-1].mnPixSize+nDelta < 0 )
|
|
|
|
{
|
|
|
|
nDelta += pItems[n-1].mnPixSize;
|
|
|
|
pItems[n-1].mnPixSize = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pItems[n-1].mnPixSize += nDelta;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
n--;
|
|
|
|
}
|
|
|
|
while ( n > nMin );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( bGreat )
|
|
|
|
{
|
|
|
|
if ( bPropGreat )
|
|
|
|
{
|
|
|
|
nTempDelta = nDelta;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
n = nPos+1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( nTempDelta )
|
|
|
|
{
|
|
|
|
pItems[n-1].mnPixSize++;
|
|
|
|
nTempDelta--;
|
|
|
|
}
|
|
|
|
n--;
|
|
|
|
}
|
|
|
|
while ( n > nMin );
|
|
|
|
}
|
|
|
|
while ( nTempDelta );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pItems[nPos].mnPixSize += nDelta;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bSmall )
|
|
|
|
{
|
|
|
|
if ( bPropSmall )
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
n = nPos+1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( nDelta && pItems[n].mnPixSize )
|
|
|
|
{
|
|
|
|
pItems[n].mnPixSize--;
|
|
|
|
nDelta--;
|
|
|
|
}
|
|
|
|
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
while ( n < nMax );
|
|
|
|
}
|
|
|
|
while ( nDelta );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
n = nPos+1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( pItems[n].mnPixSize-nDelta < 0 )
|
|
|
|
{
|
|
|
|
nDelta -= pItems[n].mnPixSize;
|
|
|
|
pItems[n].mnPixSize = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pItems[n].mnPixSize -= nDelta;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
while ( n < nMax );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Original-Groessen updaten
|
|
|
|
ImplCalcLogSize( pItems, nItems );
|
|
|
|
|
|
|
|
ImplUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::SetItemSize( sal_uInt16 nId, long nNewSize )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
|
|
|
|
ImplSplitItem* pItem;
|
|
|
|
|
|
|
|
if ( !pSet )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Testen, ob sich Groesse aendert
|
|
|
|
pItem = &(pSet->mpItems[nPos]);
|
|
|
|
if ( pItem->mnSize != nNewSize )
|
|
|
|
{
|
|
|
|
// Neue Groesse setzen und neu durchrechnen
|
|
|
|
pItem->mnSize = nNewSize;
|
2013-06-21 21:40:18 +09:00
|
|
|
pSet->mbCalcPix = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
long SplitWindow::GetItemSize( sal_uInt16 nId ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
|
|
|
|
|
|
|
|
if ( pSet )
|
|
|
|
return pSet->mpItems[nPos].mnSize;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
long SplitWindow::GetItemSize( sal_uInt16 nId, SplitWindowItemBits nBits ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
|
|
|
|
|
|
|
|
if ( pSet )
|
|
|
|
{
|
|
|
|
if ( nBits == pSet->mpItems[nPos].mnBits )
|
|
|
|
return pSet->mpItems[nPos].mnSize;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
((SplitWindow*)this)->ImplCalcLayout();
|
|
|
|
|
|
|
|
long nRelSize = 0;
|
|
|
|
long nPerSize = 0;
|
|
|
|
ImplSplitItem* pItems;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nItems;
|
2000-09-18 16:07:07 +00:00
|
|
|
SplitWindowItemBits nTempBits;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 i;
|
2000-09-18 16:07:07 +00:00
|
|
|
nItems = pSet->mnItems;
|
|
|
|
pItems = pSet->mpItems;
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
{
|
|
|
|
if ( i == nPos )
|
|
|
|
nTempBits = nBits;
|
|
|
|
else
|
|
|
|
nTempBits = pItems[i].mnBits;
|
|
|
|
if ( nTempBits & SWIB_RELATIVESIZE )
|
|
|
|
nRelSize += pItems[i].mnPixSize;
|
|
|
|
else if ( nTempBits & SWIB_PERCENTSIZE )
|
|
|
|
nPerSize += pItems[i].mnPixSize;
|
|
|
|
}
|
|
|
|
nPerSize += nRelSize;
|
|
|
|
if ( nBits & SWIB_RELATIVESIZE )
|
|
|
|
{
|
|
|
|
if ( nRelSize )
|
|
|
|
return (pItems[nPos].mnPixSize+(nRelSize/2))/nRelSize;
|
|
|
|
else
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if ( nBits & SWIB_PERCENTSIZE )
|
|
|
|
{
|
|
|
|
if ( nPerSize )
|
|
|
|
return (pItems[nPos].mnPixSize*100)/nPerSize;
|
|
|
|
else
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return pItems[nPos].mnPixSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-03-19 15:06:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
void SplitWindow::SetItemSizeRange (sal_uInt16 nId, const Range aRange)
|
2010-03-19 15:06:39 +01:00
|
|
|
{
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_uInt16 nPos;
|
2010-03-19 15:06:39 +01:00
|
|
|
ImplSplitSet* pSet = ImplFindItem(mpBaseSet, nId, nPos);
|
|
|
|
|
|
|
|
if (pSet != NULL)
|
|
|
|
{
|
|
|
|
pSet->mpItems[nPos].mnMinSize = aRange.Min();
|
|
|
|
pSet->mpItems[nPos].mnMaxSize = aRange.Max();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 SplitWindow::GetSet( sal_uInt16 nId ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
|
|
|
|
|
|
|
|
if ( pSet )
|
|
|
|
return pSet->mnId;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool SplitWindow::IsItemValid( sal_uInt16 nId ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nPos;
|
2011-08-05 15:45:21 +01:00
|
|
|
ImplSplitSet* pSet = mpBaseSet ? ImplFindItem(mpBaseSet, nId, nPos) : NULL;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( pSet )
|
2010-09-29 15:46:40 +08:00
|
|
|
return sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2010-09-29 15:46:40 +08:00
|
|
|
return sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 SplitWindow::GetItemId( Window* pWindow ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return ImplFindItem( mpBaseSet, pWindow );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 SplitWindow::GetItemId( const Point& rPos ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return ImplFindItem( mpBaseSet, rPos, mbHorz, !mbBottomRight );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 SplitWindow::GetItemPos( sal_uInt16 nId, sal_uInt16 nSetId ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId );
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nPos = SPLITWINDOW_ITEM_NOTFOUND;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( pSet )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
for ( sal_uInt16 i = 0; i < pSet->mnItems; i++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( pSet->mpItems[i].mnId == nId )
|
|
|
|
{
|
|
|
|
nPos = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 SplitWindow::GetItemId( sal_uInt16 nPos, sal_uInt16 nSetId ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId );
|
|
|
|
if ( pSet && (nPos < pSet->mnItems) )
|
|
|
|
return pSet->mpItems[nPos].mnId;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 SplitWindow::GetItemCount( sal_uInt16 nSetId ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId );
|
|
|
|
if ( pSet )
|
|
|
|
return pSet->mnItems;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::ImplNewAlign()
|
|
|
|
{
|
|
|
|
if ( mbNoAlign )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbHorz = sal_False;
|
|
|
|
mbBottomRight = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2012-02-18 14:18:19 +01:00
|
|
|
else
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-02-18 14:18:19 +01:00
|
|
|
switch ( meAlign )
|
|
|
|
{
|
|
|
|
case WINDOWALIGN_TOP:
|
|
|
|
mbHorz = sal_True;
|
|
|
|
mbBottomRight = sal_False;
|
|
|
|
break;
|
|
|
|
case WINDOWALIGN_BOTTOM:
|
|
|
|
mbHorz = sal_True;
|
|
|
|
mbBottomRight = sal_True;
|
|
|
|
break;
|
|
|
|
case WINDOWALIGN_LEFT:
|
|
|
|
mbHorz = sal_False;
|
|
|
|
mbBottomRight = sal_False;
|
|
|
|
break;
|
|
|
|
case WINDOWALIGN_RIGHT:
|
|
|
|
mbHorz = sal_False;
|
|
|
|
mbBottomRight = sal_True;
|
|
|
|
break;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( mnWinStyle & WB_BORDER )
|
|
|
|
{
|
|
|
|
ImplCalcBorder( meAlign, mbNoAlign, mnLeftBorder, mnTopBorder,
|
|
|
|
mnRightBorder, mnBottomBorder );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( IsReallyVisible() && IsUpdateMode() )
|
|
|
|
Invalidate();
|
|
|
|
ImplUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SplitWindow::SetAlign( WindowAlign eNewAlign )
|
|
|
|
{
|
|
|
|
if ( meAlign != eNewAlign )
|
|
|
|
{
|
|
|
|
meAlign = eNewAlign;
|
|
|
|
ImplNewAlign();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::ShowAutoHideButton( sal_Bool bShow )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
mbAutoHide = bShow;
|
|
|
|
ImplUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::ShowFadeInHideButton( sal_Bool bShow )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
mbFadeIn = bShow;
|
|
|
|
ImplUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::ShowFadeOutButton( sal_Bool bShow )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
mbFadeOut = bShow;
|
|
|
|
ImplUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void SplitWindow::SetAutoHideState( sal_Bool bAutoHide )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
mbAutoHideIn = bAutoHide;
|
|
|
|
if ( IsReallyVisible() )
|
|
|
|
{
|
|
|
|
Rectangle aRect;
|
|
|
|
ImplGetAutoHideRect( aRect );
|
|
|
|
Invalidate( aRect );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
long SplitWindow::GetFadeInSize() const
|
|
|
|
{
|
|
|
|
long n = 0;
|
|
|
|
|
|
|
|
if ( mbHorz )
|
|
|
|
n = mnTopBorder+mnBottomBorder;
|
|
|
|
else
|
|
|
|
n = mnLeftBorder+mnRightBorder;
|
|
|
|
|
|
|
|
return n+SPLITWIN_SPLITSIZE+SPLITWIN_SPLITSIZEEX-2;
|
|
|
|
}
|
|
|
|
|
2010-10-14 08:27:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|